# Schedule

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-system/task/trait-schedule/

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

```rust
trait Schedule: Send + Sync + 'static
```

Where the polls of a task run: called from any thread, it queues `poll` to run on the task's
thread, in order with the other work of that thread.

A poll that runs on another thread finds no task there and does nothing, so an implementation
must run its work on the thread of the tasks it was given to. A closure of the right shape is
a schedule.

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

## Members

- [`schedule`](#function-schedule)
- [`spawned`](#function-spawned)
- [`schedule_local`](#function-schedule_local)
- [`identity`](#function-identity)

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

### schedule

```rust
fn schedule(self: &Self, poll: Box<dyn FnOnce() -> () + Send>)
```

Queues `poll` to run on the thread of the task.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/schedule.rs#L14)

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

### spawned

```rust
fn spawned(self: &Self, task: AbortHandle)
```

Told on the thread of a task, before its first poll, when the task is given to this
schedule: a schedule that ends its tasks itself (a dispatcher that shuts down aborts them)
keeps the handle, and may abort the task here. Does nothing by default.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/schedule.rs#L19)

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

### schedule_local

```rust
fn schedule_local(self: &Self, work: Box<dyn FnOnce() -> ()>)
```

Queues `work`, which need not be `Send`, to run on the thread of this schedule, in order
with its other work; called on that thread (a `SynchronizationContext.Post` from the thread
of the context). By default the work is kept as a callback of the calling thread, and the
schedule is given a piece of work that runs it there; work that the schedule drops without
running it is dropped on its thread, the next time that thread runs its queue
(`run_pending`). A schedule that can hold work that is not `Send` (a
dispatcher) queues it directly.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/schedule.rs#L30)

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

### identity

```rust
fn identity(self: &Self) -> *const ()
```

The identity of the schedule, by which `is_current_schedule`
compares two of them: by default the address of the schedule. A schedule that stands for
another object (an adapter) gives the address of that object, so that two of them for the
same object are the same schedule.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.System/task/schedule.rs#L39)

## Trait implementations

- [`Schedule`](/docs/0.5.0/api/ferroui-system/task/trait-schedule/)

## Availability

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