# IDeferredContent

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/controls/trait-ideferredcontent/

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

```rust
trait IDeferredContent
```

Represents a deferred content: content that is built on demand, the first
time it is requested.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_deferred_content.rs#L7)

## Members

- [`build`](#function-build)
- [`try_build`](#function-try_build)

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

### build

```rust
fn build(self: &Self, service_provider: Option<&Rc<dyn IServiceProvider>>) -> Option<BoxedValue>
```

Builds the deferred content. `service_provider` is the service
provider to build it with, if any; deferred resources are built with
none.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_deferred_content.rs#L11)

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

### try_build

```rust
fn try_build(self: &Self, service_provider: Option<&Rc<dyn IServiceProvider>>) -> Result<Option<BoxedValue>, DeferredContentFailed>
```

Builds the deferred content, or reports that it could not be built.

`Err` means that the build failed and that the content reported its error itself: the
deferred content of the markup runtime gives it to the open error scope of the load
(`ferroui_markup_xaml::xaml_error_scope`), which returns it as the error of the load. The
caller then goes on as if the content were not there, and does not keep the failed build:
the next request builds again. Content without an error channel never fails; the default
builds with `build`.

An addition (#567): where the reference throws out of the build, this reports the error
without unwinding, so that a load can return it with `panic = "abort"`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/i_deferred_content.rs#L24)

## Availability

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