Skip to content

Define empty for Filler? #84

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
yanganto opened this issue Mar 25, 2025 · 1 comment · Fixed by #91
Closed

Define empty for Filler? #84

yanganto opened this issue Mar 25, 2025 · 1 comment · Fixed by #91
Labels
enhancement New feature or request

Comments

@yanganto
Copy link
Owner

yanganto commented Mar 25, 2025

The #[filler(empty_value=value)] is implemented. However, we do not need so much macros. The filler rely on is_empty function. The user can implement the is_empty for his customized struct. We will consider add #[filler(empty=fn)]

#[derive(struct_patch::Filler, Debug, PartialEq, Default)]
struct Color {
    R: u8,
    G: u8,
    B: u8,
    #[filler(empty_value=0)]
    // or #[filler(default_is_empty)]
    alpha: u8,
}
@yanganto
Copy link
Owner Author

The #[filler(full=fn)], #[filler(full_value=value)], and #[filler(default_is_empty)] will not implement. Because user can add filler to gather before applying so the fulls are not useful, and the #[filler(default_is_empty)] can be replaced by #[filler(empty=default)].

@yanganto yanganto changed the title Define empty and full of field with Filler? Define empty for Filler? Apr 28, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant