Attribute Macro adsabs_macro::make_optional [−][src]
#[make_optional]
Expand description
Processes a struct to convert the fields to Option
s
For now, this will always convert all field types to Option
, but the
goal is to someday add filtering for skipping some fields. The usage is
straightforward: just decorate your struct
with #[make_optional]
. For
example, the following
use adsabs_macro::make_optional;
#[make_optional]
struct ExampleStruct {
id: usize,
name: String,
}
will be re-written to something like
struct ExampleStruct {
id: Option<usize>,
name: Option<String>,
}