@@ -848,6 +848,29 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
848
848
. unwrap_or_else ( |e| e. into_compile_error ( ) . into ( ) )
849
849
}
850
850
851
+ /// This macro enables you to derive object properties in a quick way.
852
+ ///
853
+ /// # Getters and setters
854
+ /// By default, they are generated for you.
855
+ /// You can use a custom getter/setter by assigning an expression to `get`/`set`.
856
+ /// Example: `#[property(get = |_| 2, set)]`.
857
+ ///
858
+ /// The macro will always generate, on the wrapper type, the corresponding `$property()` and
859
+ /// `set_$property()` methods.
860
+ /// Notice: you can't reimplement the generated methods on the wrapper type, but you can change their
861
+ /// behavior using a custom getter/setter.
862
+ ///
863
+ /// # Supported types
864
+ /// Every type implementing the trait `Property` is supported.
865
+ /// If you want to support a custom type, you should consider implementing `Property` and
866
+ /// `PropertyGet`. If your type supports interior mutability, you should implement also
867
+ /// `PropertySet` and `PropertySetNested` if possible.
868
+ /// The type `Option<T>` is supported as a property only if `Option<T>` implements `ToValueOptional`.
869
+ /// If your type doesn't support `PropertySet`, you can't use the generated setter, but you can
870
+ /// always define a custom one.
871
+ /// If you want to support a custom type with a custom `ParamSpec`, you should implement the trait
872
+ /// `HasParamSpec` instead of `Property`.
873
+ ///
851
874
/// # Example
852
875
/// ```
853
876
/// use std::cell::RefCell;
0 commit comments