# spawn_local

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/task/function-spawn_local/

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

```rust
fn spawn_local<F>(future: F) -> super::join::JoinHandle<<F as >::Output>
where F: Future + 'static,
      <F as >::Output: 'static
```

Runs `future` as a task of the current thread, in the queue of the thread, and gives its
handle. The future is polled at once, up to its first pending await, and again whenever it is
woken: at once on this thread (inside the call that wakes it, or right after its own poll when
the wake comes from inside it), and when the thread runs [`run_pending`](/docs/0.5.0/api/ferroui-system/task/function-run_pending/) for a wake from
another thread (the module's documentation).

Spawned in the work of a schedule ([`current_schedule`](/docs/0.5.0/api/ferroui-system/task/function-current_schedule/): a dispatcher job), the task takes that
schedule instead: a wake on this thread while the same schedule is current (a job of the same
dispatcher and priority) polls it at once, as above; any other wake, from this thread or
another, queues one poll on the schedule (a job at that priority). This is the rule of `await`
in .NET, which runs a continuation inline when the completing code runs in the captured
`SynchronizationContext` and posts it there otherwise.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/executor.rs#L443)

## Availability

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