# HeadlessUnitTestTask

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-headless/struct-headlessunittesttask/

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

```rust
struct HeadlessUnitTestTask<T>
```

The outcome of an action dispatched to a [`HeadlessUnitTestSession`](/docs/0.5.0/api/ferroui-headless/struct-headlessunittestsession/);
what the original returns as a task object.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_unit_test_session.rs#L105)

## Members

- [`is_completed`](#function-is_completed)
- [`wait`](#function-wait)
- [`wait_timeout`](#function-wait_timeout)

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

### is_completed

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

Whether the task has finished: completed, failed or cancelled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_unit_test_session.rs#L111)

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

### wait

```rust
fn wait(self: Self) -> Result<T, Canceled>
```

Blocks until the task has finished and takes its result
(`GetAwaiter().GetResult()`). Not to be called on the session thread,
which is the thread that has to make progress.
## Panics
Raises the panic of the dispatched action, or of the cleanup after
it, again.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_unit_test_session.rs#L122)

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

### wait_timeout

```rust
fn wait_timeout(self: Self, timeout: Duration) -> Result<T, Canceled>
```

Blocks until the task has finished or `timeout` has passed
(`WaitAsync(TimeSpan)`).
## Panics
Panics when the task has not finished in time (`TimeoutException`);
otherwise as `wait`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_unit_test_session.rs#L132)

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

## Availability

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