# StyleInclude

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

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

```rust
struct StyleInclude
```

Includes a style from a URL.

The document is loaded the first time the style is asked for.

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

## Members

- [`new`](#function-new)
- [`with_service_provider`](#function-with_service_provider)
- [`owner`](#function-owner)
- [`source`](#function-source)
- [`set_source`](#function-set_source)
- [`loaded`](#function-loaded)
- [`try_loaded`](#function-try_loaded)
- [`as_style`](#function-as_style)

<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/style_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/style_include.rs#L41)

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

### owner

```rust
fn owner(self: &Self) -> Option<ResourceHostRef>
```

The owner of the loaded style, if it is a resource provider.

Inside an error scope of a load, a document that cannot be loaded is
the error of the scope and there is no owner.

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

<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/style_include.rs#L69)

<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/style_include.rs#L73)

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

### loaded

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

The loaded style; loads it on first use.
## Panics
Panics if `source` is not set, if the document cannot
be loaded or if it is not a style. 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/style_include.rs#L94)

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

### try_loaded

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

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

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

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

### as_style

```rust
fn as_style(self: &Self) -> Rc<dyn IStyle>
```

The include as the style contract.

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

## 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/)
- [`IStyle`](/docs/0.5.0/api/ferroui-base/styling/trait-istyle/)
- [`IResourceProvider`](/docs/0.5.0/api/ferroui-base/controls/trait-iresourceprovider/)
- `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/).
