Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs of glib::derived_properties #1143

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions glib-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
///
/// ## Using Rust keywords as property names
/// You might hit a roadblock when declaring properties with this macro because you want to use a name that happens to be a Rust keyword. This may happen with names like `loop`, which is a pretty common name when creating things like animation handlers.
/// To use those names, you can make use of the raw identifier feature of Rust. Simply prefix the identifier name with `r#` in the struct declaration. Internally, those `r#`s are stripped so you can use its expected name in [`ObjectExt::property`] or within GtkBuilder template files.

Check warning on line 886 in glib-macros/src/lib.rs

View workflow job for this annotation

GitHub Actions / build

unresolved link to `ObjectExt::property`
///
/// # Generated wrapper methods
/// The following methods are generated on the wrapper type specified on `#[properties(wrapper_type = ...)]`:
Expand Down Expand Up @@ -1001,9 +1001,14 @@
properties::impl_derive_props(input)
}

/// This macro is shorteng for:
///
/// When applied to `ObjectImpl`
/// ```ignore
/// #[glib::derived_properties]
/// impl ObjectImpl for CustomObject
/// ```
/// this macro generates
/// ```ignore
/// impl ObjectImpl for CustomObject {
/// fn properties() -> &'static [glib::ParamSpec] {
/// Self::derived_properties()
/// }
Expand All @@ -1013,9 +1018,8 @@
/// fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
/// self.derived_property(id, pspec)
/// }
/// }
/// ```
///
/// for ObjectImpl trait implementation
#[proc_macro_attribute]
#[proc_macro_error]
pub fn derived_properties(_attr: TokenStream, item: TokenStream) -> TokenStream {
Expand Down