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
Trait Implementations
Returns the “default value” for a type. Read more