alloc::task::Wake - Rust
Description: API documentation for the Rust `Wake` trait in crate `alloc`.
Keywords: rust, rustlang, rust-lang, Wake

# [−][src]Trait alloc::task::Wake

    pub trait Wake {
        fn wake(self: Arc<Self>);

        fn wake_by_ref(self: &Arc<Self>) { ... }
    }

🔬 This is a nightly-only experimental API. (`wake_trait` #69912)

The implementation of waking a task on an executor.

This trait can be used to create a `Waker`. An executor can define an implementation of this trait, and use that to construct a Waker to pass to the tasks that are executed on that executor.

This trait is a memory-safe and ergonomic alternative to constructing a `RawWaker`. It supports the common executor design in which the data used to wake up a task is stored in an `Arc`. Some executors (especially those for embedded systems) cannot use this API, which is why `RawWaker` exists as an alternative for those systems.

## Required methods

### `fn wake(self: Arc<Self>)`[src]

🔬 This is a nightly-only experimental API. (`wake_trait` #69912)

Wake this task.

Loading content...

## Provided methods

### `fn wake_by_ref(self: &Arc<Self>)`[src]

🔬 This is a nightly-only experimental API. (`wake_trait` #69912)

Wake this task without consuming the waker.

If an executor supports a cheaper way to wake without consuming the waker, it should override this method. By default, it clones the `Arc` and calls `wake` on the clone.

Loading content...

## Implementors

Loading content...