# ferro_property

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/macro-ferro_property/

**macro** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
macro_rules! ferro_property
```

Declares the accessor of a single property definition.

```ignore
impl Border {
    ferro_property!(pub fn background_property() -> StyledProperty<Option<Ref<Brush>>> {
        FerroProperty::register::<Border, _>("Background", None)
    });
}
```

The property is registered the first time the accessor is called on a
thread. Property definitions, like the objects that use them, belong to
the thread that created them.

On its own the macro registers nothing until the accessor is called, so a
lookup by name can miss the property. Declare the properties of a type in
a `ferro_properties!` block instead, which also registers them when the
type is initialised.

Where an accessor cannot be written inside the block (it is generated by
a local macro, or declared between other items), name the type whose
initialisation it belongs to and list it in the block of that type:

```ignore
ferro_property!(for XYFocus; pub fn left_property() -> AttachedProperty<..> { .. });

ferro_properties! { impl XYFocus, also [XYFocus::left_property] {} }
```

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/ferro_property.rs#L982)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
