# settable_prop

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/macro-settable_prop/

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

```rust
macro_rules! settable_prop
```

A [`SettableProperty`](/docs/0.5.0/api/ferroui-reactiveui/binding/bindings/struct-settableproperty/) from getters: the path of `prop!` and the
setter `set_<last getter>` of the object that owns the last property.

`settable_prop!(View => name_text)` reads with `name_text()`, observes `NameText` and writes
with `set_name_text(value)`; `settable_prop!(Person => address.street)` writes with
`address().set_street(value)`. The steps take `as "Name"` as `prop!`
does; the setter is named after the getter all the same.

```
use ferroui_reactiveui::settable_prop;
use ferroui_system::component_model::INotifyPropertyChanged;
use ferroui_system::events::Event;
use std::cell::RefCell;
use std::rc::Rc;

struct Person { name: RefCell<String>, changed: Event<str> }
impl Person {
    fn name(&self) -> String { self.name.borrow().clone() }
    fn set_name(&self, value: String) { *self.name.borrow_mut() = value; self.changed.raise("Name"); }
}
impl INotifyPropertyChanged for Person {
    fn property_changed(&self) -> &Event<str> { &self.changed }
}

let property = settable_prop!(Person => name);
let person = Rc::new(Person { name: RefCell::new(String::new()), changed: Event::new() });
property.set(&person, "Ada".to_owned());
assert_eq!(property.get(&person), "Ada");
assert_eq!(property.path().path(), "Name");
```

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/settable_property.rs#L97)

## Availability

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