# FuncTemplate

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

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

```rust
struct FuncTemplate<TControl>
```

Creates a control from a function.

`TControl` is the exact value produced. When the template is used as a
setter value it must be the value type of the setter's property (for
example `Option<Ref<Control>>`).

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

## Members

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

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

### new

```rust
fn new(func: impl Fn() -> TControl + 'static) -> Rc<Self>
```

Creates a template from the function used to create the control.

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

## 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`
- [`ITemplateOf<TControl>`](/docs/0.5.0/api/ferroui-controls/templates/trait-itemplateof/)
- [`ITemplate`](/docs/0.5.0/api/ferroui-base/styling/trait-itemplate/)

## Availability

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