# FuncControlTemplate

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

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

```rust
struct FuncControlTemplate
```

A template for a [`TemplatedControl`](/docs/0.5.0/api/ferroui-controls/primitives/struct-templatedcontrol/).

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

## Members

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

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

### new

```rust
fn new(build: impl Fn(&Ref<TemplatedControl>, &NameScopeRef) -> Ref<Control> + 'static) -> Rc<Self>
```

Creates a control template from the function used to create the
control tree for a templated control.

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

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

### for_type

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

Creates a control template for templated controls of class `T`.

Panics when applied to a control of another class.

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

## 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<Ref<TemplatedControl>, Option<TemplateResult<Ref<Control>>>>`](/docs/0.5.0/api/ferroui-controls/templates/trait-itemplatewithparam/)
- [`IControlTemplate`](/docs/0.5.0/api/ferroui-controls/templates/trait-icontroltemplate/)

## Availability

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