# Setter

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/styling/struct-setter/

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

```rust
struct Setter
```

A setter for a `Style`.

A setter describes what will take place when the requirements for a style
are met: it sets a property to a value, binds it to a source of values or
sets it to the result of a template.

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

## Members

- [`empty`](#function-empty)
- [`new`](#function-new)
- [`new_untyped`](#function-new_untyped)
- [`new_binding`](#function-new_binding)
- [`new_binding_base`](#function-new_binding_base)
- [`new_template`](#function-new_template)
- [`with_value`](#function-with_value)
- [`property`](#function-property)
- [`set_property`](#function-set_property)
- [`target`](#function-target)
- [`set_target`](#function-set_target)
- [`value`](#function-value)
- [`set_value`](#function-set_value)
- [`set_setter_value`](#function-set_setter_value)

<a id="function-empty"></a>

### empty

```rust
fn empty() -> Rc<Self>
```

Creates a setter without a property or value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L73)

<a id="function-new"></a>

### new

```rust
fn new<T: PropertyValue>(property: &'static StyledProperty<T>, value: T) -> Rc<Self>
```

Creates a setter that sets a styled property to a value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L78)

<a id="function-new_untyped"></a>

### new_untyped

```rust
fn new_untyped(property: &'static FerroProperty, value: BoxedValue) -> Rc<Self>
```

Creates a setter that sets a property to an untyped value, which must
hold exactly the property's value type.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L84)

<a id="function-new_binding"></a>

### new_binding

```rust
fn new_binding(property: &'static FerroProperty, source: Rc<dyn IObservable<BoxedValue>>) -> Rc<Self>
```

Creates a setter that binds a property to a source of values.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L89)

<a id="function-new_binding_base"></a>

### new_binding_base

```rust
fn new_binding_base(property: &'static FerroProperty, binding: Rc<dyn BindingBase>) -> Rc<Self>
```

Creates a setter that binds a property with a binding (a compiled,
string-path, template or multi binding).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L95)

<a id="function-new_template"></a>

### new_template

```rust
fn new_template(property: &'static FerroProperty, template: Rc<dyn ITemplate>) -> Rc<Self>
```

Creates a setter that sets a property to the object built by a
template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L101)

<a id="function-with_value"></a>

### with_value

```rust
fn with_value(property: &'static FerroProperty, value: SetterValue) -> Rc<Self>
```

Creates a setter for a property with the given kind of value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L106)

<a id="function-property"></a>

### property

```rust
fn property(self: &Self) -> Option<&'static FerroProperty>
```

The property to set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L114)

<a id="function-set_property"></a>

### set_property

```rust
fn set_property(self: &Self, value: Option<&'static FerroProperty>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L118)

<a id="function-target"></a>

### target

```rust
fn target(self: &Self) -> Option<Rc<TargetPropertyPath>>
```

The target of the setter in a visual state (WinUI's `Setter.Target`): the object whose
`property` the setter sets. `None` (the default) for the setters of
styles, which set the property of the element the style applies to.

An addition (docs/porting/winui-calculator-gaps.md, section 5.2). A style with a setter
that has a target is an error, as `Setter.Property` in a visual state is in WinUI.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L128)

<a id="function-set_target"></a>

### set_target

```rust
fn set_target(self: &Self, value: Option<Rc<TargetPropertyPath>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L132)

<a id="function-value"></a>

### value

```rust
fn value(self: &Self) -> Option<SetterValue>
```

The property value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L137)

<a id="function-set_value"></a>

### set_value

```rust
fn set_value(self: &Self, value: Option<SetterValue>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L141)

<a id="function-set_setter_value"></a>

### set_setter_value

```rust
fn set_setter_value(self: &Self, value: &dyn ISetterValue, boxed: BoxedValue)
```

Sets a plain value that wants to be notified that it has become a
setter value. `boxed` is the value as it will be set on the property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/styling/setter.rs#L147)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- [`IAnimationSetter`](/docs/0.5.0/api/ferroui-base/animation/trait-ianimationsetter/)
- `PartialEq`
- `Default`
- [`ISetterInstance`](/docs/0.5.0/api/ferroui-base/styling/trait-isetterinstance/)
- [`SetterBase`](/docs/0.5.0/api/ferroui-base/styling/trait-setterbase/)
- `Display`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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