# ModelTypeBuilder

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/model/struct-modeltypebuilder/

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

```rust
struct ModelTypeBuilder<T: PartialEq + 'static>
```

Declares the binding metadata of model type `T`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L104)

## Members

- [`notify_property_changed`](#function-notify_property_changed)
- [`notify_data_error_info`](#function-notify_data_error_info)
- [`list`](#function-list)
- [`indexer`](#function-indexer)
- [`array`](#function-array)
- [`notify_collection_changed`](#function-notify_collection_changed)
- [`command`](#function-command)
- [`property_info`](#function-property_info)
- [`read_only`](#function-read_only)
- [`property`](#function-property)
- [`validated_property`](#function-validated_property)
- [`method`](#function-method)
- [`method_with_can_execute`](#function-method_with_can_execute)

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

### notify_property_changed

```rust
fn notify_property_changed(self: Self) -> Self
where T: INotifyPropertyChanged
```

Declares that the type raises property change notifications.

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

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

### notify_data_error_info

```rust
fn notify_data_error_info(self: Self) -> Self
where T: INotifyDataErrorInfo
```

Declares that the type reports validation errors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L140)

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

### list

```rust
fn list(self: Self) -> Self
where T: IBindableList
```

Declares that the type is a list that binding indexers can index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L152)

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

### indexer

```rust
fn indexer(self: Self) -> Self
where T: IBindableIndexer
```

Declares that the type has an indexer that binding indexers can use
(`Items[key]`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L165)

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

### array

```rust
fn array(self: Self) -> Self
where T: IBindableArray
```

Declares that the type is an array: a fixed-size collection accessed
with integer indexes, one per dimension.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L178)

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

### notify_collection_changed

```rust
fn notify_collection_changed(self: Self) -> Self
where T: INotifyCollectionChanged
```

Declares that the type raises collection change notifications.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L190)

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

### command

```rust
fn command(self: Self) -> Self
where T: ICommand
```

Declares that the type is a command, so that instances can be bound to
command properties.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L203)

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

### property_info

```rust
fn property_info(self: Self, property: Rc<dyn IPropertyInfo>) -> Self
```

Declares a property from a ready-made description.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L215)

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

### read_only

```rust
fn read_only<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static) -> Self
```

Declares a read-only property. `K` states how the typed value maps to
an untyped binding value, see `PropertyKind`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L222)

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

### property

```rust
fn property<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static, set: impl Fn(&T, <K as >::Typed) -> () + 'static) -> Self
```

Declares a read-write property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L227)

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

### validated_property

```rust
fn validated_property<K: PropertyKind>(self: Self, name: &str, get: impl Fn(&T) -> <K as >::Typed + 'static, set: impl Fn(&T, <K as >::Typed) -> Result<(), BindingError> + 'static) -> Self
```

Declares a read-write property whose setter can reject a value. The
error surfaces as a data validation error on bindings that have data
validation enabled (the equivalent of throwing from a setter).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L239)

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

### method

```rust
fn method(self: Self, name: &str, execute: impl Fn(&T, Option<&BoxedValue>) -> () + 'static) -> Self
```

Declares a method that bindings can use as a command.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L249)

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

### method_with_can_execute

```rust
fn method_with_can_execute(self: Self, name: &str, execute: impl Fn(&T, Option<&BoxedValue>) -> () + 'static, can_execute: impl Fn(&T, Option<&BoxedValue>) -> bool + 'static, depends_on: &[&str]) -> Self
```

Declares a method with a "can execute" predicate that is re-queried
when one of the properties named in `depends_on` changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/model/model_type.rs#L265)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

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