# AssetLoader

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/platform/struct-assetloader/

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

```rust
struct AssetLoader
```

Provides access to the assets compiled into the application binary,
through the registered [`IAssetLoader`](/docs/0.5.0/api/ferroui-base/platform/trait-iassetloader/).

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

## 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(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/asset_loader.rs#L21)

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

### exists

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

Checks if an asset with the specified URI exists.

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

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

### open

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

Opens the asset with the requested URI.

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

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

### open_and_get_assembly

```rust
fn open_and_get_assembly(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/asset_loader.rs#L37)

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

### get_assembly

```rust
fn get_assembly(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/asset_loader.rs#L45)

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

### get_assets

```rust
fn get_assets(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/asset_loader.rs#L51)

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

### invalidate_assembly_cache

```rust
fn invalidate_assembly_cache(name: &str)
```

Removes the cached descriptor of the assembly with the given name.

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

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

### invalidate_assembly_cache_all

```rust
fn invalidate_assembly_cache_all()
```

Removes all cached assembly descriptors.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

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