You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// This macro enables you to derive object properties in a quick way.
853
853
///
854
+
/// # Supported #[property] attributes
855
+
/// | Attribute | Description | Default | Example |
856
+
/// | --- | --- | --- | --- |
857
+
/// | `name = "literal"` | The name of the property | field ident where `_` (leading and trailing `_` are trimmed) is replaced into `-` | `#[property(name = "prop-name")]` |
858
+
/// | `type = expr` | The type of the property | inferred | `#[property(type = i32)]` |
859
+
/// | `get [= expr]` | Specify that the property is readable and use `PropertyGet::get` [or optionally set a custom internal getter] | | `#[property(get)]`, `#[property(get = get_prop)]`, or `[property(get = \|_\| 2)]` |
860
+
/// | `set [= expr]` | Specify that the property is writable and use `PropertySet::set` [or optionally set a custom internal setter] | | `#[property(set)]`, `#[property(set = set_prop)]`, or `[property(set = \|_, val\| {})]` |
861
+
/// | `override_class = expr` | The type of class of which to override the property from | | `#[property(override_class = SomeClass)]` |
862
+
/// | `override_interface = expr` | The type of interface of which to override the property from | | `#[property(override_interface = SomeInterface)]` |
863
+
/// | `nullable` | Whether to use `Option<T>` in the wrapper's generated setter | | `#[property(nullable)]` |
864
+
/// | `member = ident` | Field of the nested type where property is retrieved and set | | `#[property(member = author)]` |
865
+
/// | `builder(<required-params>)[.ident]*` | Used to input required params or add optional Param Spec builder fields | | `#[property(builder(SomeEnum::default()))]`, `#[builder().default_value(1).construct_only()]`, etc. |
866
+
/// | `default` | Sets the `default_value` field of the Param Spec builder | | `#[property(default = 1)]` |
867
+
/// | `<optional-pspec-builder-fields> = expr` | Used to add optional Param Spec builder fields | | `#[property(minimum = 0)` , `#[property(minimum = 0, maximum = 1)]`, etc. |
868
+
/// | `<optional-pspec-builder-fields>` | Used to add optional Param Spec builder fields | | `#[property(explicit_notify)]` , `#[property(construct_only)]`, etc. |
869
+
///
854
870
/// # Generated wrapper methods
855
871
/// The following methods are generated on the wrapper type specified on `#[properties(wrapper_type = ...)]`:
856
872
/// * `$property()`, when the property is readable
0 commit comments