2 unstable releases

0.2.0 Jan 19, 2023
0.1.0 Jan 19, 2023

#1153 in Rust patterns

Download history 239/week @ 2023-12-19 105/week @ 2023-12-26 124/week @ 2024-01-02 183/week @ 2024-01-09 167/week @ 2024-01-16 330/week @ 2024-01-23 327/week @ 2024-01-30 310/week @ 2024-02-06 174/week @ 2024-02-13 466/week @ 2024-02-20 526/week @ 2024-02-27 290/week @ 2024-03-05 395/week @ 2024-03-12 573/week @ 2024-03-19 463/week @ 2024-03-26 727/week @ 2024-04-02

2,199 downloads per month
Used in 3 crates (2 directly)

MIT/Apache

8KB

is_empty

example workflow
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.

Dependencies

~1.5MB
~34K SLoC