Skip to content

Commit 61b49c4

Browse files
committed
glib-macros: Fix links in property macros docs
1 parent c65d064 commit 61b49c4

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

glib-macros/src/lib.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,8 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
12191219
/// | --- | --- | --- | --- |
12201220
/// | `name = "literal"` | The name of the property | field ident where `_` (leading and trailing `_` are trimmed) is replaced into `-` | `#[property(name = "prop-name")]` |
12211221
/// | `type = expr` | The type of the property | inferred | `#[property(type = i32)]` |
1222-
/// | `get [= expr]` | Specify that the property is readable and use `PropertyGet::get` [or optionally set a custom internal getter] | | `#[property(get)]`, `#[property(get = get_prop)]`, or `[property(get = \|_\| 2)]` |
1223-
/// | `set [= expr]` | Specify that the property is writable and use `PropertySet::set` [or optionally set a custom internal setter] | | `#[property(set)]`, `#[property(set = set_prop)]`, or `[property(set = \|_, val\| {})]` |
1222+
/// | `get [= expr]` | Specify that the property is readable and use [`PropertyGet::get`] [or optionally set a custom internal getter] | | `#[property(get)]`, `#[property(get = get_prop)]`, or `[property(get = \|_\| 2)]` |
1223+
/// | `set [= expr]` | Specify that the property is writable and use [`PropertySet::set`] [or optionally set a custom internal setter] | | `#[property(set)]`, `#[property(set = set_prop)]`, or `[property(set = \|_, val\| {})]` |
12241224
/// | `override_class = expr` | The type of class of which to override the property from | | `#[property(override_class = SomeClass)]` |
12251225
/// | `override_interface = expr` | The type of interface of which to override the property from | | `#[property(override_interface = SomeInterface)]` |
12261226
/// | `nullable` | Whether to use `Option<T>` in the generated setter method | | `#[property(nullable)]` |
@@ -1256,32 +1256,32 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
12561256
/// by assigning an expression to `get`/`set` `#[property]` attributes: `#[property(get = |_| 2, set)]` or `#[property(get, set = custom_setter_func)]`.
12571257
///
12581258
/// # Supported types
1259-
/// Every type implementing the trait `Property` is supported.
1260-
/// The type `Option<T>` is supported as a property only if `Option<T>` implements `ToValueOptional`.
1259+
/// Every type implementing the trait [`Property`] is supported.
1260+
/// The type `Option<T>` is supported as a property only if `Option<T>` implements [`ToValueOptional`].
12611261
/// Optional types also require the `nullable` attribute: without it, the generated setter on the wrapper type
12621262
/// will take `T` instead of `Option<T>`, preventing the user from ever calling the setter with a `None` value.
12631263
///
12641264
/// ## Adding support for custom types
1265-
/// ### Types wrapping an existing `T: glib::value::ToValue + glib::HasParamSpec`
1265+
/// ### Types wrapping an existing <code>T: [ToValue] + [HasParamSpec]</code>
12661266
/// If you have declared a newtype as
12671267
/// ```rust
12681268
/// struct MyInt(i32);
12691269
/// ```
1270-
/// you can use it as a property by deriving `glib::ValueDelegate`.
1270+
/// you can use it as a property by deriving [`ValueDelegate`].
12711271
///
12721272
/// ### Types with inner mutability
1273-
/// The trait `glib::Property` must be implemented.
1274-
/// The traits `PropertyGet` and `PropertySet` should be implemented to enable the Properties macro
1273+
/// The trait [`Property`] must be implemented.
1274+
/// The traits [`PropertyGet`] and [`PropertySet`] should be implemented to enable the Properties macro
12751275
/// to generate a default internal getter/setter.
1276-
/// If possible, implementing `PropertySetNested` is preferred over `PropertySet`, because it
1276+
/// If possible, implementing [`PropertySetNested`] is preferred over `PropertySet`, because it
12771277
/// enables this macro to access the contained type and provide access to its fields,
12781278
/// using the `member = $structfield` syntax.
12791279
///
1280-
/// ### Types without `glib::HasParamSpec`
1281-
/// If you have encountered a type `T: glib::value::ToValue`, inside the `gtk-rs` crate, which doesn't implement `HasParamSpec`,
1280+
/// ### Types without [`HasParamSpec`][HasParamSpec]
1281+
/// If you have encountered a type <code>T: [ToValue]</code>, inside the gtk-rs crate, which doesn't implement [`HasParamSpec`][HasParamSpec],
12821282
/// then it's a bug and you should report it.
1283-
/// If you need to support a `ToValue` type with a `ParamSpec` not provided by `gtk-rs`, then you need to
1284-
/// implement `glib::HasParamSpec` on that type.
1283+
/// If you need to support a `ToValue` type with a [`ParamSpec`] not provided by gtk-rs, then you need to
1284+
/// implement `HasParamSpec` on that type.
12851285
///
12861286
/// # Example
12871287
/// ```
@@ -1348,6 +1348,18 @@ pub fn cstr_bytes(item: TokenStream) -> TokenStream {
13481348
/// assert_eq!(myfoo.fizz(), "custom set: test value".to_string());
13491349
/// }
13501350
/// ```
1351+
///
1352+
/// [`Property`]: ../glib/property/trait.Property.html
1353+
/// [`PropertyGet`]: ../glib/property/trait.PropertyGet.html
1354+
/// [`PropertyGet::get`]: ../glib/property/trait.PropertyGet.html#tymethod.get
1355+
/// [`PropertySet`]: ../glib/property/trait.PropertySet.html
1356+
/// [`PropertySet::set`]: ../glib/property/trait.PropertySet.html#tymethod.set
1357+
/// [`PropertySetNested`]: ../glib/property/trait.PropertySetNested.html
1358+
/// [`ObjectExt::property`]: ../glib/object/trait.ObjectExt.html#tymethod.property
1359+
/// [HasParamSpec]: ../glib/trait.HasParamSpec.html
1360+
/// [`ParamSpec`]: ../glib/struct.ParamSpec.html
1361+
/// [`ToValueOptional`]: ../glib/value/trait.ToValueOptional.html
1362+
/// [ToValue]: ../glib/value/trait.ToValue.html
13511363
#[allow(clippy::needless_doctest_main)]
13521364
#[proc_macro_derive(Properties, attributes(properties, property))]
13531365
pub fn derive_props(input: TokenStream) -> TokenStream {

0 commit comments

Comments
 (0)