Skip to content

Commit c462808

Browse files
committed
Document requirement for explicit default in Enum properties
When using the `Property` macro with enum types that derive `Enum`, the default value must be explicitly set using `#[property(builder(...))]`.
1 parent 69b7b7e commit c462808

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

glib-macros/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -525,32 +525,30 @@ pub fn closure_local(item: TokenStream) -> TokenStream {
525525
/// }
526526
/// ```
527527
///
528-
/// When using [`glib::Properties`] with an enum that derives [`glib::Enum`], the
529-
/// default value must be explicitly set via the `builder` parameter of the
528+
/// When using [`Properties`] with an enum that derives [`Enum`], the default
529+
/// value must be explicitly set via the `builder` parameter of the
530530
/// `#[property]` attribute.
531531
///
532-
/// # Example
533-
///
534-
/// ```
532+
/// ```ignore
535533
/// use glib::prelude::*;
536534
/// use glib::subclass::prelude::*;
537535
///
538536
/// #[derive(Debug, Copy, Clone, PartialEq, Eq, glib::Enum)]
539537
/// #[enum_type(name = "MyEnum")]
540538
/// enum MyEnum {
541539
/// Val,
542-
/// ...
540+
/// // ...
543541
/// }
544542
///
545543
/// mod imp {
546544
/// use std::cell::Cell;
547545
///
548546
/// #[derive(Debug, Default, glib::Properties)]
549-
/// #[properties(wrapper_type = super::MyObject)
547+
/// #[properties(wrapper_type = super::MyObject)]
550548
/// pub MyObject {
551549
/// #[property(get, set, builder(MyEnum::Val))]
552550
/// my_enum: Cell<MyEnum>,
553-
/// ...
551+
/// // ...
554552
/// }
555553
/// }
556554
/// ```

0 commit comments

Comments
 (0)