macro_rules! extensions_options { ( $(#[doc = $struct_d:tt])* $vis:vis struct $struct_name:ident { $( $(#[doc = $d:tt])* $field_vis:vis $field_name:ident : $field_type:ty, default = $default:expr )*$(,)* } ) => { ... }; }
Expand description
Convenience macro to create ExtensionsOptions.
The created structure implements the following traits:
§Usage
The syntax is:
extensions_options! {
/// Struct docs (optional).
[<vis>] struct <StructName> {
/// Field docs (optional)
[<vis>] <field_name>: <field_type>, default = <default_value>
... more fields
}
}
The placeholders are:
[<vis>]: Optional visibility modifier likepuborpub(crate).<StructName>: Struct name likeMyStruct.<field_name>: Field name likemy_field.<field_type>: Field type likeu8.<default_value>: Default value matching the field type like42.
§Example
use datafusion_common::extensions_options;
extensions_options! {
/// My own config options.
pub struct MyConfig {
/// Should "foo" be replaced by "bar"?
pub foo_to_bar: bool, default = true
/// How many "baz" should be created?
pub baz_count: usize, default = 1337
}
}