is_empty

Crates.iois_empty
lib.rsis_empty
version0.3.0
sourcesrc
created_at2023-01-19 15:23:05.572485
updated_at2024-11-09 13:28:06.344417
descriptionEasily check if the struct is empty.
homepage
repositoryhttps://github.com/puilp0502/is_empty
max_upload_size
id762647
size13,536
Frank Yang (puilp0502)

documentation

https://docs.rs/is_empty

README

is_empty

CI status Docs Badge

Easily check if the struct is empty.

Usage

use is_empty::IsEmpty;

#[derive(IsEmpty)]
struct Foo {
    a: Option<String>,
    b: Option<String>,
}

let foo = Foo {
    a: Some("a".to_string()),
    b: None,
};
assert!(!foo.is_empty());

let bar = Foo {
   a: None,
   b: None,
};
assert!(bar.is_empty());

Acknowledgements

This crate was made possible by the excellent blog series on derive macros by Jonas Platte.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 15

cargo fmt