Crates.io | struf |
lib.rs | struf |
version | 0.0.1 |
source | src |
created_at | 2023-08-26 13:44:37.749959 |
updated_at | 2023-08-26 13:44:37.749959 |
description | Struct Filters |
homepage | |
repository | https://github.com/nmoutschen/struf |
max_upload_size | |
id | 955538 |
size | 2,299 |
Automatically create filters for struct
s.
Warning: this crate is highly experimental. Use at your own risk, and please report any bugs on as issues on GitHub.
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);