@@ -850,24 +850,31 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
850
850
851
851
/// This macro enables you to derive object properties in a quick way.
852
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)]`.
853
+ /// # Generated wrapper methods
854
+ /// The following methods are generated on the wrapper type specified on `#[properties(wrapper_type = ...)]`:
855
+ /// * `$property()`, when the property is readable
856
+ /// * `set_$property()`, when the property is writable and not construct-only
857
+ /// * `connect_$property_notify()`
858
+ /// * `notify_$property()`
857
859
///
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.
860
+ /// Notice: You can't reimplement the generated methods on the wrapper type,
861
+ /// but you can change their behavior using a custom internal getter/setter.
862
+ ///
863
+ /// # Internal getters and setters
864
+ /// By default, they are generated for you. However, you can use a custom getter/setter
865
+ /// by assigning an expression to `get`/`set`: `#[property(get = |_| 2, set)]` or `#[property(get, set = custom_setter_func)]`.
862
866
///
863
867
/// # Supported types
864
868
/// Every type implementing the trait `Property` is supported.
869
+ ///
865
870
/// If you want to support a custom type, you should consider implementing `Property` and
866
871
/// `PropertyGet`. If your type supports interior mutability, you should implement also
867
872
/// `PropertySet` and `PropertySetNested` if possible.
873
+ ///
868
874
/// The type `Option<T>` is supported as a property only if `Option<T>` implements `ToValueOptional`.
869
875
/// If your type doesn't support `PropertySet`, you can't use the generated setter, but you can
870
876
/// always define a custom one.
877
+ ///
871
878
/// If you want to support a custom type with a custom `ParamSpec`, you should implement the trait
872
879
/// `HasParamSpec` instead of `Property`.
873
880
///
@@ -916,16 +923,11 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
916
923
/// fn properties() -> &'static [ParamSpec] {
917
924
/// Self::derived_properties()
918
925
/// }
919
- /// fn set_property(
920
- /// &self,
921
- /// _id: usize,
922
- /// _value: &Value,
923
- /// _pspec: &ParamSpec,
924
- /// ) {
925
- /// Self::derived_set_property(self, _id, _value, _pspec)
926
+ /// fn set_property(&self, id: usize, value: &Value, pspec: &ParamSpec) {
927
+ /// self.derived_set_property(id, value, pspec)
926
928
/// }
927
- /// fn property(&self, _id : usize, _pspec : &ParamSpec) -> Value {
928
- /// Self:: derived_property(self, _id, _pspec )
929
+ /// fn property(&self, id : usize, pspec : &ParamSpec) -> Value {
930
+ /// self. derived_property(id, pspec )
929
931
/// }
930
932
/// }
931
933
///
0 commit comments