struf_derive

Crates.iostruf_derive
lib.rsstruf_derive
version0.0.1
sourcesrc
created_at2023-08-26 13:43:09.508137
updated_at2023-08-26 13:43:09.508137
descriptionDerive for Struct Filters
homepage
repositoryhttps://github.com/nmoutschen/struf
max_upload_size
id955536
size6,703
Nicolas Moutschen (nmoutschen)

documentation

README

Struf: Struct Filters

Automatically create filters for structs.

Warning: this crate is highly experimental. Use at your own risk, and please report any bugs on as issues on GitHub.

Usage

use struf::Filter;

#[derive(Filter)]
pub struct MyStruct {
    #[filter]
    pub name: String,
}

// Filter on a single value
let filter = MyStruct::filter().with_name("my_name");

// Filter on multiple values
let filter = MyStruct::filter().with_names(vec!["name_a", "name_b"]);

// Access filter values
dbg!(&filter.names);
Commit count: 10

cargo fmt