# AutoPersistMetadata

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/mixins/struct-autopersistmetadata/

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

```rust
struct AutoPersistMetadata
```

What AutoPersist needs to know of an object: whether it is a data contract, and which of its
properties are persisted (`AutoPersistHelperMixins.AutoPersistMetadata`).

Upstream reads it by reflection from `[DataContract]` and `[DataMember]`; here it is given
explicitly, or declared once per type with [`DataContract`](/docs/0.5.0/api/ferroui-reactiveui/mixins/trait-datacontract/) and read with
`for_type`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L39)

## Members

- [`new`](#function-new)
- [`with_properties`](#function-with_properties)
- [`with_path`](#function-with_path)
- [`has_data_contract`](#function-has_data_contract)
- [`persistable_property_names`](#function-persistable_property_names)
- [`for_type`](#function-for_type)
- [`provider_for_type`](#function-provider_for_type)

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

### new

```rust
fn new<S: Into<String>>(has_data_contract: bool, persistable_property_names: impl IntoIterator<Item = S>) -> Self
```

The metadata of an object: whether it is a data contract, and the names of its persisted
properties, in PascalCase (`AutoPersistMetadata(bool, ISet<string>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L58)

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

### with_properties

```rust
fn with_properties<S: Into<String>>(persistable_property_names: impl IntoIterator<Item = S>) -> Self
```

The metadata of a data contract whose persisted properties are `persistable_property_names`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L63)

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

### with_path

```rust
fn with_path<S: 'static, V: 'static>(self: Self, path: &ferroui_system::component_model::PropertyPath<S, V>) -> Self
```

Adds the property at the start of `path` to the persisted properties, for a list written
with `prop!` rather than with names.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L69)

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

### has_data_contract

```rust
fn has_data_contract(self: &Self) -> bool
```

Whether the object is a data contract (`HasDataContract`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L77)

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

### persistable_property_names

```rust
fn persistable_property_names(self: &Self) -> &HashSet<String>
```

The names of the persisted properties (`PersistablePropertyNames`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L82)

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

### for_type

```rust
fn for_type<T: DataContract>() -> Rc<AutoPersistMetadata>
```

The metadata a type declares with `DataContract`, created once per type and thread
(`AutoPersistHelperMixins.CreateMetadata<T>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L88)

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

### provider_for_type

```rust
fn provider_for_type<T: DataContract>() -> MetadataProvider<T>
```

A provider that gives the metadata of `for_type` for every item
(`AutoPersistHelperMixins.CreateMetadataProvider<TItem>()`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/mixins/auto_persist_helper_mixins_persistence.rs#L100)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Debug`

## Availability

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