Struct stop_token::StopSource[][src]

pub struct StopSource { /* fields omitted */ }
Expand description

StopSource produces StopToken and cancels all of its tokens on drop.

Example:

let stop_source = StopSource::new();
let stop_token = stop_source.stop_token();
schedule_some_work(stop_token);
drop(stop_source); // At this point, scheduled work notices that it is canceled.

Implementations

Creates a new StopSource.

Produces a new StopToken, associated with this source.

Once the source is destroyed, StopToken future completes.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.