# HotReloadSession

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-hot-reload/struct-hotreloadsession/

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

```rust
struct HotReloadSession
```

Sources become authoritative only after every affected live target commits successfully.
Session ownership is intentionally `!Send`: callers must pump it on the UI thread.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L104)

## Members

- [`new`](#function-new)
- [`for_runtime_documents`](#function-for_runtime_documents)
- [`register_document`](#function-register_document)
- [`bind_class`](#function-bind_class)
- [`register_target`](#function-register_target)
- [`track_resource_includes`](#function-track_resource_includes)
- [`track_style_includes`](#function-track_style_includes)
- [`submit`](#function-submit)
- [`reapply_document`](#function-reapply_document)
- [`submit_texts`](#function-submit_texts)
- [`submit_files`](#function-submit_files)
- [`sources`](#function-sources)
- [`applied_revision`](#function-applied_revision)
- [`has_pending_changes`](#function-has_pending_changes)
- [`apply_pending`](#function-apply_pending)
- [`apply_pending_with`](#function-apply_pending_with)

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

### new

```rust
fn new() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L126)

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

### for_runtime_documents

```rust
fn for_runtime_documents() -> Self
```

Creates a session for runtime-instantiated documents whose target adapters replace
the entire affected object graph, including namescopes and event subscriptions.
Structural contracts are accepted only after every target commits successfully.
Compiled class population overrides are prohibited in this mode; application and
manifest sessions retain the default restart protection for contract changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L134)

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

### register_document

```rust
fn register_document(self: &mut Self, uri: String, source: String) -> Result<(), ReloadError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L139)

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

### bind_class

```rust
fn bind_class(self: &mut Self, class: &'static ferroui_base::TypeInfo, uri: String, configuration: ferroui_markup_xaml::RuntimeXamlLoaderConfiguration) -> Result<(), ReloadError>
```

New instances populate from the last accepted snapshot. Existing instances need
a ReloadTarget adapter; this hook never clears a live root.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L166)

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

### register_target

```rust
fn register_target(self: &mut Self, target: &Rc<dyn ReloadTarget>)
```

The application owns its adapters. Closed components disappear when their adapters are dropped.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L218)

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

### track_resource_includes

```rust
fn track_resource_includes(self: &mut Self, owner: &ferroui_base::Ref<ferroui_base::controls::ResourceDictionary>, configuration: ferroui_markup_xaml::RuntimeXamlLoaderConfiguration)
```

Track direct resource includes in this container, including later additions
and removals. Only includes whose documents belong to this session are adopted.
Owners are weakly held. Repeated registration keeps the first configuration.
All registered targets conservatively depend on these includes, so static
consumers prepare with the same resource revision. Do not also manually
register adapters for the same contributions.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L230)

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

### track_style_includes

```rust
fn track_style_includes(self: &mut Self, owner: &ferroui_base::Ref<ferroui_base::styling::Styles>, configuration: ferroui_markup_xaml::RuntimeXamlLoaderConfiguration)
```

Track direct style includes with the same ownership and dependency rules as
`track_resource_includes`. Arbitrary inline styles need explicit adapters.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L239)

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

### submit

```rust
fn submit(self: &mut Self, uri: String, text: String) -> u64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L246)

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

### reapply_document

```rust
fn reapply_document(self: &mut Self, uri: &str) -> Result<u64, ReloadError>
```

Reapply an explicitly registered view after its Rust builder changes.
Keep a pending editor draft and any read errors: a builder request must
not silently replace newer text with the accepted source or hide a failure.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L256)

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

### submit_texts

```rust
fn submit_texts(self: &mut Self, documents: impl IntoIterator<Item = (String, String)>) -> u64
```

Submit editor/supervisor text as one revision, without rebuilding targets
for unchanged accepted documents. Returning to accepted text discards that
document's failed draft; drafts and read errors for other documents remain.
Resubmitting a pending draft explicitly retries its failed transaction.
Use `submit` when a view must be reapplied even with identical markup.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L275)

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

### submit_files

```rust
fn submit_files(self: &mut Self, batch: FileBatch) -> u64
```

Submit a complete watcher snapshot as one revision. Read errors block the
transaction, including older pending edits, until that document recovers.
Editors can recover an unreadable file by submitting its unsaved text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L295)

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

### sources

```rust
fn sources(self: &Self) -> Rc<Sources>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L317)

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

### applied_revision

```rust
fn applied_revision(self: &Self) -> u64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L320)

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

### has_pending_changes

```rust
fn has_pending_changes(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L323)

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

### apply_pending

```rust
fn apply_pending(self: &mut Self) -> Option<ReloadOutcome>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L332)

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

### apply_pending_with

```rust
fn apply_pending_with(self: &mut Self, finalize: impl FnOnce() -> Result<(), ReloadError>) -> Option<ReloadOutcome>
```

Coordinate an external update with the markup transaction. The callback
runs once, after every target commits but before accepted sources publish
and old graphs/subscriptions are released. A callback error rolls back all
target commits. Preparation/commit failure never invokes the callback.

The callback must leave its own state unchanged on error or panic. After
success, adapter `finish` is infallible cleanup: it must not panic. This
cannot roll back arbitrary external effects or an already installed patch.
A supervisor can install a validated synchronous function patch here and
publish both revisions only after installation succeeds. Observers invoked
synchronously by adapter commit still see the provisional graph; adapters
must honor their existing reversible-side-effect contract.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.HotReload/lib.rs#L347)

## 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`
- `Default`
- `Drop`

## Availability

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