# IAssetLoader

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/platform/trait-iassetloader/

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

```rust
trait IAssetLoader: 'static
```

Loads assets compiled into the application binary.

The interface and its service registration are considered unstable; use
the functions of `AssetLoader` instead.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L40)

## Members

- [`set_default_assembly`](#function-set_default_assembly)
- [`exists`](#function-exists)
- [`open`](#function-open)
- [`open_and_get_assembly`](#function-open_and_get_assembly)
- [`get_assembly`](#function-get_assembly)
- [`get_assets`](#function-get_assets)
- [`invalidate_assembly_cache`](#function-invalidate_assembly_cache)
- [`invalidate_assembly_cache_all`](#function-invalidate_assembly_cache_all)

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

### set_default_assembly

```rust
fn set_default_assembly(self: &Self, assembly: &AssetAssembly)
```

Sets the default assembly from which to load embedded-resource
(`resm:`) assets for which no assembly is specified.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L43)

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

### exists

```rust
fn exists(self: &Self, uri: &UriRef, base_uri: Option<&url::Url>) -> bool
```

Checks if an asset with the specified URI exists.

`base_uri` is a base URI to use if `uri` is relative: the reference
resolves against it with `UriRef::resolve`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L49)

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

### open

```rust
fn open(self: &Self, uri: &UriRef, base_uri: Option<&url::Url>) -> std::io::Result<Box<dyn AssetStream>>
```

Opens the asset with the requested URI.

Fails with `std::io::ErrorKind::NotFound` when the asset could not
be found.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L55)

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

### open_and_get_assembly

```rust
fn open_and_get_assembly(self: &Self, uri: &UriRef, base_uri: Option<&url::Url>) -> std::io::Result<(Box<dyn AssetStream>, AssetAssembly)>
```

Opens the asset with the requested URI and returns the asset stream
along with the assembly containing the asset.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L59)

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

### get_assembly

```rust
fn get_assembly(self: &Self, uri: &UriRef, base_uri: Option<&url::Url>) -> Option<AssetAssembly>
```

Extracts the assembly information from a URI.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L66)

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

### get_assets

```rust
fn get_assets(self: &Self, uri: &UriRef, base_uri: Option<&url::Url>) -> Vec<url::Url>
```

Gets all assets of a folder and its subfolders that match the
specified URI.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L70)

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

### invalidate_assembly_cache

```rust
fn invalidate_assembly_cache(self: &Self, name: &str)
```

Removes the cached descriptor of the assembly with the given name, so
that assets it registered afterwards become visible.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L74)

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

### invalidate_assembly_cache_all

```rust
fn invalidate_assembly_cache_all(self: &Self)
```

Removes all cached assembly descriptors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/platform/i_asset_loader.rs#L77)

## Trait implementations

- [`IAssetLoader`](/docs/0.5.0/api/ferroui-base/platform/trait-iassetloader/)

## Availability

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