# FerroXamlLoader

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-markup-xaml/struct-ferroxamlloader/

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

```rust
struct FerroXamlLoader
```

Loads XAML for a FerroUI application.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L59)

## Members

- [`register_compiled_xaml`](#function-register_compiled_xaml)
- [`unregister_compiled_xaml`](#function-unregister_compiled_xaml)
- [`load_object`](#function-load_object)
- [`load_object_with_service_provider`](#function-load_object_with_service_provider)
- [`load`](#function-load)
- [`load_with_service_provider`](#function-load_with_service_provider)
- [`try_load_with_service_provider`](#function-try_load_with_service_provider)
- [`scoped_populate_override`](#function-scoped_populate_override)
- [`set_populate_override`](#function-set_populate_override)
- [`remove_populate_override`](#function-remove_populate_override)
- [`populate_override`](#function-populate_override)
- [`track_instance`](#function-track_instance)
- [`live_instances`](#function-live_instances)

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

### register_compiled_xaml

```rust
fn register_compiled_xaml(assembly_name: &str, try_load: CompiledXamlLoader)
```

Registers the loader of the compiled documents of the assembly
(crate) named `assembly_name`, replacing a previous registration.
Called by the generated startup code of a crate with compiled XAML.

The assembly of a URI is the one the asset loader reports for it
(`IAssetLoader::get_assembly`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L68)

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

### unregister_compiled_xaml

```rust
fn unregister_compiled_xaml(assembly_name: &str) -> bool
```

Removes the registration of an assembly. Returns whether there was
one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L75)

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

### load_object

```rust
fn load_object(obj: &BoxedValue) -> Result<(), XamlLoadError>
```

Loads the XAML into a FerroUI component.

This is the hook the XAML compiler replaces: in a class with
compiled markup the call is rewritten to the generated populate
method of the class. Reaching it at run time means that no compiled
markup exists for the type of `obj`, which is the error it reports.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L90)

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

### load_object_with_service_provider

```rust
fn load_object_with_service_provider(sp: Option<&Rc<dyn IServiceProvider>>, obj: &BoxedValue) -> Result<(), XamlLoadError>
```

`load_object` with the service provider of the
place the component is loaded into.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L96)

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

### load

```rust
fn load(uri: &UriRef, base_uri: Option<&url::Url>) -> Result<BoxedValue, XamlLoadError>
```

Loads XAML from a URI.

`base_uri` is the URL `uri` is relative to; it is required when
`uri` is relative, which is resolved against it with
`UriRef::resolve`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L128)

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

### load_with_service_provider

```rust
fn load_with_service_provider(sp: Option<&Rc<dyn IServiceProvider>>, uri: &UriRef, base_uri: Option<&url::Url>) -> Result<BoxedValue, XamlLoadError>
```

Loads XAML from a URI, giving the root of the document `sp` as its
parent service provider.
## Panics
Panics if no asset loader is registered, or if `uri` is relative and
`base_uri` is `None`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L138)

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

### try_load_with_service_provider

```rust
fn try_load_with_service_provider(sp: Option<&Rc<dyn IServiceProvider>>, uri: &UriRef, base_uri: Option<&url::Url>) -> Result<BoxedValue, XamlLoadError>
```

`load_with_service_provider`
without panics: a missing asset loader and a relative URI without a
base URI are errors too. This is what untyped (metadata) callers
use.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/ferro_xaml_loader.rs#L156)

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

### scoped_populate_override

```rust
fn scoped_populate_override(class: &'static TypeInfo, populate: PopulateOverride) -> PopulateOverrideGuard
```

Constructor overrides take precedence over persistent development overrides.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L40)

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

### set_populate_override

```rust
fn set_populate_override(class: &'static TypeInfo, populate: Option<PopulateOverride>) -> Option<PopulateOverride>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L54)

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

### remove_populate_override

```rust
fn remove_populate_override(class: &'static TypeInfo, expected: &PopulateOverride)
```

Removes only the persistent hook owned by the caller. Safe during TLS
teardown and independent of any active constructor-scoped override.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L71)

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

### populate_override

```rust
fn populate_override(class: &'static TypeInfo) -> Option<PopulateOverride>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L85)

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

### track_instance

```rust
fn track_instance<T: ferroui_base::ObjectType>(class: &'static TypeInfo, root: &ferroui_base::Ref<T>)
```

Weakly records a component without retaining it or changing its lifetime.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L171)

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

### live_instances

```rust
fn live_instances(class: &'static TypeInfo) -> Vec<ferroui_base::Ref<ferroui_base::FerroObject>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Markup/FerroUI.Markup.Xaml/populate_overrides.rs#L192)

## 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`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

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