Skip to content

Commit f4e98fc

Browse files
committed
macros: further tweak docs
- have both the nullable and the not nullable case in the examples, otherwise user may assume that nullable is needed - Replace 'eventually' with 'optionally' - Align the SharedBoxed documentation
1 parent 60aaf3d commit f4e98fc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

glib-macros/src/lib.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@ pub fn error_domain_derive(input: TokenStream) -> TokenStream {
530530
}
531531

532532
/// Derive macro for defining a [`BoxedType`]`::type_` function and
533-
/// the [`glib::Value`] traits. Eventually, the type can be set as `nullable` to
534-
/// get an implemention of `glib::value::ToValueOptional`.
533+
/// the [`glib::Value`] traits. Optionally, the type can be marked as
534+
/// `nullable` to get an implemention of `glib::value::ToValueOptional`.
535535
///
536536
/// # Example
537537
///
@@ -540,8 +540,12 @@ pub fn error_domain_derive(input: TokenStream) -> TokenStream {
540540
/// use glib::subclass::prelude::*;
541541
///
542542
/// #[derive(Clone, Debug, PartialEq, Eq, glib::Boxed)]
543-
/// #[boxed_type(name = "MyBoxed", nullable)]
543+
/// #[boxed_type(name = "MyBoxed")]
544544
/// struct MyBoxed(String);
545+
///
546+
/// #[derive(Clone, Debug, PartialEq, Eq, glib::Boxed)]
547+
/// #[boxed_type(name = "MyNullableBoxed", nullable)]
548+
/// struct MyNullableBoxed(String);
545549
/// ```
546550
///
547551
/// [`BoxedType`]: ../glib/subclass/boxed/trait.BoxedType.html
@@ -555,7 +559,8 @@ pub fn boxed_derive(input: TokenStream) -> TokenStream {
555559
}
556560

557561
/// Derive macro for defining a [`SharedType`]`::get_type` function and
558-
/// the [`glib::Value`] traits.
562+
/// the [`glib::Value`] traits. Optionally, the type can be marked as
563+
/// `nullable` to get an implemention of `glib::value::ToValueOptional`.
559564
///
560565
/// # Example
561566
///
@@ -567,9 +572,14 @@ pub fn boxed_derive(input: TokenStream) -> TokenStream {
567572
/// struct MySharedInner {
568573
/// foo: String,
569574
/// }
575+
///
570576
/// #[derive(Clone, Debug, PartialEq, Eq, glib::SharedBoxed)]
571577
/// #[shared_boxed_type(name = "MySharedBoxed")]
572-
/// struct MyShared(std::sync::Arc<MySharedInner>);
578+
/// struct MySharedBoxed(std::sync::Arc<MySharedInner>);
579+
///
580+
/// #[derive(Clone, Debug, PartialEq, Eq, glib::SharedBoxed)]
581+
/// #[shared_boxed_type(name = "MyNullableSharedBoxed", nullable)]
582+
/// struct MyNullableSharedBoxed(std::sync::Arc<MySharedInner>);
573583
/// ```
574584
///
575585
/// [`SharedType`]: ../glib/subclass/shared/trait.SharedType.html

0 commit comments

Comments
 (0)