#macro-derive #empty #struct #string #foo

macro is_empty_derive

Easily check if the struct is empty

1 unstable release

0.1.0 Jan 19, 2023

#20 in #empty

Download history 1223/week @ 2025-10-20 1273/week @ 2025-10-27 684/week @ 2025-11-03 612/week @ 2025-11-10 1660/week @ 2025-11-17 577/week @ 2025-11-24 666/week @ 2025-12-01 577/week @ 2025-12-08 564/week @ 2025-12-15 250/week @ 2025-12-22 360/week @ 2025-12-29 439/week @ 2026-01-05 878/week @ 2026-01-12 878/week @ 2026-01-19 474/week @ 2026-01-26 721/week @ 2026-02-02

2,957 downloads per month
Used in 10 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
~39K SLoC