1 unstable release

0.1.0 Jan 19, 2023

#35 in #empty

Download history 378/week @ 2023-12-12 242/week @ 2023-12-19 107/week @ 2023-12-26 128/week @ 2024-01-02 187/week @ 2024-01-09 170/week @ 2024-01-16 332/week @ 2024-01-23 326/week @ 2024-01-30 307/week @ 2024-02-06 174/week @ 2024-02-13 452/week @ 2024-02-20 510/week @ 2024-02-27 281/week @ 2024-03-05 382/week @ 2024-03-12 557/week @ 2024-03-19 427/week @ 2024-03-26

1,715 downloads per month
Used in 4 crates (via is_empty)

MIT/Apache

6KB
101 lines

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.

Dependencies

~1.5MB
~34K SLoC