FilterStruct
Simple macro for create instances of structs with more ergonomic syntax.
Installation
cargo add filterstruct
How to use
Define your struct as usual:
Then, define your filter using the filter! macro:
)
};
}
Now you can create instances of UserFilter using the user_filter! macro:
let filter = user_filter!
This will create a UserFilter instance with the id field set to a new UUID, and all other fields set to their default values.
Also, you can use shorthand for fields that you want to set to Some(value):
let email = Stringfrom;
let filter = user_filter!