pub struct TaskSpawner { /* private fields */ }Expand description
A generation-bound capability for cancellation-aware child tasks.
Implementations§
Source§impl TaskSpawner
impl TaskSpawner
Sourcepub fn cancellation_token(&self) -> CancellationToken
pub fn cancellation_token(&self) -> CancellationToken
Returns a non-authoritative cancellation signal for this generation.
Sourcepub fn spawn<F>(&self, future: F) -> Result<(), TaskSpawnError>
pub fn spawn<F>(&self, future: F) -> Result<(), TaskSpawnError>
Registers future before allowing it to poll.
§Errors
Returns an error when this spawner no longer belongs to the open generation.
Sourcepub fn spawn_named<F>(
&self,
name: &'static str,
future: F,
) -> Result<TaskRef, TaskSpawnError>
pub fn spawn_named<F>( &self, name: &'static str, future: F, ) -> Result<TaskRef, TaskSpawnError>
Registers a named future before allowing it to poll.
The returned reference observes identity and terminal state without owning cancellation or joining. The task may reach a terminal state before this method returns.
§Errors
Returns an error when this spawner no longer belongs to the open generation.
§Panics
Panics if the process exhausts the u64 task identifier space.
Trait Implementations§
Source§impl Clone for TaskSpawner
impl Clone for TaskSpawner
Auto Trait Implementations§
impl !RefUnwindSafe for TaskSpawner
impl !UnwindSafe for TaskSpawner
impl Freeze for TaskSpawner
impl Send for TaskSpawner
impl Sync for TaskSpawner
impl Unpin for TaskSpawner
impl UnsafeUnpin for TaskSpawner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more