# FuncTreeDataTemplate

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/templates/struct-functreedatatemplate/

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

```rust
struct FuncTreeDataTemplate
```

A template used to build hierarchical data.

`items_selector` returns the child items of an item as the untyped value
assigned to the target property, so it must hold exactly the value type
of that property.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/func_tree_data_template.rs#L13)

## Members

- [`new`](#function-new)
- [`for_type`](#function-for_type)
- [`for_type_with_match`](#function-for_type_with_match)

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

### new

```rust
fn new(match_: impl Fn(Option<&BoxedValue>) -> bool + 'static, build: impl Fn(&Option<BoxedValue>, &NameScopeRef) -> Option<Ref<Control>> + 'static, items_selector: impl Fn(&BoxedValue) -> BoxedValue + 'static) -> Rc<Self>
```

Creates a tree data template.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/func_tree_data_template.rs#L20)

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

### for_type

```rust
fn for_type<T: 'static>(build: impl Fn(&T, &NameScopeRef) -> Option<Ref<Control>> + 'static, items_selector: impl Fn(&T) -> BoxedValue + 'static) -> Rc<Self>
```

Creates a tree data template that matches data of type `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/func_tree_data_template.rs#L29)

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

### for_type_with_match

```rust
fn for_type_with_match<T: 'static>(match_: impl Fn(&T) -> bool + 'static, build: impl Fn(&T, &NameScopeRef) -> Option<Ref<Control>> + 'static, items_selector: impl Fn(&T) -> BoxedValue + 'static) -> Rc<Self>
```

Creates a tree data template that matches data of type `T` accepted
by `match_`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/templates/func_tree_data_template.rs#L41)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`ITemplateWithParam<Option<Rc<dyn AnyValue>>, Option<Ref<Control>>>`](/docs/0.5.0/api/ferroui-controls/templates/trait-itemplatewithparam/)
- [`IDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-idatatemplate/)
- [`IRecyclingDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-irecyclingdatatemplate/)
- [`ITreeDataTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-itreedatatemplate/)

## Availability

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