# ModeDetector

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-splat/mode_detection/struct-modedetector/

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

```rust
struct ModeDetector
```

Whether the code runs under a unit test runner, as the current detector tells, cached
(`ModeDetector`). The detector is a [`DefaultModeDetector`](/docs/0.5.0/api/ferroui-splat/mode_detection/struct-defaultmodedetector/) until it is overridden.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/mode_detection/mode_detector.rs#L16)

## Members

- [`override_mode_detector`](#function-override_mode_detector)
- [`in_unit_test_runner`](#function-in_unit_test_runner)

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

### override_mode_detector

```rust
fn override_mode_detector(mode_detector: Rc<dyn IModeDetector>)
```

Replaces the detector and forgets the cached result (`OverrideModeDetector`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/mode_detection/mode_detector.rs#L29)

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

### in_unit_test_runner

```rust
fn in_unit_test_runner() -> bool
```

Whether the code runs under a unit test runner (`InUnitTestRunner`): the cached result, or
what the detector tells, `false` when it cannot tell.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Splat/mode_detection/mode_detector.rs#L36)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`

## Availability

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