# TaskValue

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/core/plugins/struct-taskvalue/

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

```rust
struct TaskValue
```

A task as a value that can be stored in a property and streamed by a
binding with the `^` operator: the handle to the eventual outcome of an
asynchronous operation, which is an untyped result or an error. It has
identity equality.

The outcome is produced by a [`TaskValueSource`](/docs/0.5.0/api/ferroui-base/data/core/plugins/struct-taskvaluesource/), by a future running on
the dispatcher (`TaskValue::run`) or is known up front
(`TaskValue::from_result`, `TaskValue::from_exception`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L50)

## Members

- [`from_result`](#function-from_result)
- [`from_untyped_result`](#function-from_untyped_result)
- [`from_exception`](#function-from_exception)
- [`run`](#function-run)
- [`is_completed`](#function-is_completed)
- [`is_completed_successfully`](#function-is_completed_successfully)
- [`is_faulted`](#function-is_faulted)
- [`result`](#function-result)
- [`continue_with`](#function-continue_with)

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

### from_result

```rust
fn from_result<T: PropertyValue>(value: T) -> Self
```

A task that has completed with `value`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L54)

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

### from_untyped_result

```rust
fn from_untyped_result(value: Option<BoxedValue>) -> Self
```

A task that has completed with an untyped value: null, a boxed value
or a shared model object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L60)

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

### from_exception

```rust
fn from_exception(error: BindingError) -> Self
```

A task that has failed with `error`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L65)

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

### run

```rust
fn run<F>(future: F) -> Self
where F: Future<Output = Result<Option<BoxedValue>, BindingError>> + 'static
```

Runs `future` on the dispatcher of the calling thread and returns the
task for its outcome. A future that is dropped before it completes
(the dispatcher shut down, the future panicked) leaves the task
running forever.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L73)

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

### is_completed

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

Whether the task has finished: completed or failed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L93)

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

### is_completed_successfully

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

Whether the task ran to completion.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L98)

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

### is_faulted

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

Whether the task failed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L103)

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

### result

```rust
fn result(self: &Self) -> Option<Result<Option<BoxedValue>, BindingError>>
```

The outcome of the task, if it has finished.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L108)

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

### continue_with

```rust
fn continue_with(self: &Self, continuation: impl FnOnce() -> () + 'static)
```

Runs `continuation` when the task finishes; right away if it has
finished already. The continuation runs where the task is completed:
a caller that needs it on the dispatcher posts from it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/plugins/task_stream_plugin.rs#L119)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`

## Availability

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