#[derive(FromVarargs)]
{
// Attributes available to this derive:
#[opt]
#[skip]
}
Expand description
Enable struct types to be parsed as argument lists.
The FromVarargs trait can be derived for structure types where each type implements
FromVariant. The order of fields matter for this purpose:
ⓘ
#[derive(FromVarargs)]
struct MyArgs {
foo: i32,
bar: String,
#[opt] baz: Option<Ref<Node>>,
}§Field attributes
Attributes can be used to customize behavior of certain fields. All attributes are optional.
§#[opt]
Marks an argument as optional. Required arguments must precede all optional arguments.
Default values are obtained through Default::default.
§#[skip]
Instructs the macro to skip a field. Skipped fields do not affect the signature of the
argument list. They may be located anywhere. Values are obtained through Default::default.