# FileWatcher

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

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

```rust
struct FileWatcher
```



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

## Members

- [`changes`](#struct_field-changes)
- [`new`](#function-new)
- [`with_baseline`](#function-with_baseline)
- [`with_directories`](#function-with_directories)

<a id="struct_field-changes"></a>

### changes

```rust
changes: std::sync::mpsc::Receiver<FileBatch>
```



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

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

### new

```rust
fn new(files: BTreeMap<String, PathBuf>, interval: Duration) -> Self
```

Files map canonical document URI to source path. Two identical reads debounce partial saves.

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

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

### with_baseline

```rust
fn with_baseline(files: BTreeMap<String, PathBuf>, interval: Duration, baseline: BTreeMap<String, String>) -> Self
```

Start from the exact source snapshot loaded by the caller, avoiding a startup
race when an editor saves before the worker takes its first sample.

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

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

### with_directories

```rust
fn with_directories(files: BTreeMap<String, PathBuf>, directories: Vec<WatchDirectory>, interval: Duration, baseline: BTreeMap<String, String>) -> Self
```

Discover XAML files recursively as well as watching the original manifest
paths. New documents still require session admission; discovery never
silently establishes a new compiled compatibility baseline.

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

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

## Availability

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