# prop

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/macro-prop/

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

```rust
macro_rules! prop
```

A [`PropertyPath`](/docs/0.5.0/api/ferroui-system/component_model/struct-propertypath/) from getters (`x => x.Name`, `x => x.Address.Street`).

```
use ferroui_system::component_model::INotifyPropertyChanged;
use ferroui_system::events::Event;
use std::cell::Cell;
use std::rc::Rc;

struct Person { age: Cell<i32>, changed: Event<str> }
impl Person {
    fn age(&self) -> i32 { self.age.get() }
}
impl INotifyPropertyChanged for Person {
    fn property_changed(&self) -> &Event<str> { &self.changed }
}

let path = ferroui_system::prop!(Person => age);
let person = Rc::new(Person { age: Cell::new(3), changed: Event::new() });
assert_eq!(path.get(&person), 3);
assert_eq!(path.path(), "Age");
```

Each step is a getter method of an object that raises `PropertyChanged`; its property name is
the getter's in PascalCase (`favorite_color` is `FavoriteColor`), or the one given with
`as "Name"`. The steps after the first are objects held in `Rc`.

`prop!(object Type => getter)` is the path of one property of an object that does not raise
`PropertyChanged` itself (`PropertyPath::object_property`): its step gives the object as its
owner, for an observer chosen at run time.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/component_model/property_path.rs#L454)

## Availability

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