# run

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/threading/tasks/function-run/

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

```rust
fn run<T: Clone + Send + 'static>(work: impl FnOnce() -> Result<T, Box<dyn std::error::Error + Send + Sync>> + Send + 'static) -> crate::task::Shared<Result<T, crate::ObservableError>>
```

Runs `work` on another thread and gives the outcome, which ends on the current thread
(`Task.Run`): the outcome is the [`Shared`](/docs/0.5.0/api/ferroui-system/task/struct-shared/) of a task of the current thread
([`crate::task::spawn_local`](/docs/0.5.0/api/ferroui-system/task/function-spawn_local/)), woken from the worker through the schedule of the thread, or the
queue of [`crate::task::run_pending`](/docs/0.5.0/api/ferroui-system/task/function-run_pending/). An `Err` of the work, or a panic, is a
[`TaskWorkError`](/docs/0.5.0/api/ferroui-system/threading/tasks/struct-taskworkerror/) with its message; `Shared::flatten` is a future of the result.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/threading/tasks/local_executor.rs#L130)

## Availability

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