# ResourceInclude

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

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

```rust
struct ResourceInclude
```

Loads a resource dictionary from a specified URL.

The document is loaded the first time the resources are asked for.

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

## Members

- [`new`](#function-new)
- [`with_service_provider`](#function-with_service_provider)
- [`loaded`](#function-loaded)
- [`try_loaded`](#function-try_loaded)
- [`source`](#function-source)
- [`set_source`](#function-set_source)
- [`as_resource_provider`](#function-as_resource_provider)
- [`as_theme_variant_provider`](#function-as_theme_variant_provider)

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

### new

```rust
fn new(base_uri: Option<url::Url>) -> Rc<Self>
```

Initializes a new instance: `base_uri` is the URL of the document
that contains the include, which a relative source is resolved
against (`UriRef::resolve`).

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

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

### with_service_provider

```rust
fn with_service_provider(service_provider: Rc<dyn IServiceProvider>) -> Rc<Self>
```

Initializes a new instance with the service provider of the place
the include is declared in.

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

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

### loaded

```rust
fn loaded(self: &Self) -> Rc<dyn IResourceDictionary>
```

The loaded resource dictionary; loads it on first use.
## Panics
Panics if `source` is not set, if the document cannot
be loaded or if it is not a resource dictionary. Use
`try_loaded` to handle a document that cannot be
loaded.

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

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

### try_loaded

```rust
fn try_loaded(self: &Self) -> Result<Rc<dyn IResourceDictionary>, XamlLoadError>
```

The loaded resource dictionary; loads it on first use. A missing
`source`, a document that cannot be loaded and a
document that is not a resource dictionary are errors.

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

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

### source

```rust
fn source(self: &Self) -> Option<UriRef>
```

The source URL: an absolute URL, or a reference relative to the base
URI of the include.

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

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

### set_source

```rust
fn set_source(self: &Self, value: Option<UriRef>)
```



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

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

### as_resource_provider

```rust
fn as_resource_provider(self: &Self) -> Rc<dyn IResourceProvider>
```

The include as the resource provider contract.

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

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

### as_theme_variant_provider

```rust
fn as_theme_variant_provider(self: &Self) -> Rc<dyn IThemeVariantProvider>
```

The include as the theme variant provider contract.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`IResourceNode`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourcenode/)
- [`IResourceProvider`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourceprovider/)
- [`IThemeVariantProvider`](/docs/0.5.0/api/ferroui-base/controls/trait-ithemevariantprovider/)
- `PartialEq`
- [`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/).
