pub struct AnyTaskSpawner(/* private fields */);Expand description
A type-erased TaskSpawner, so the concrete ProcessContext /
InitContext (whose signatures are fixed by the leaf trait and can’t
name the plugin’s task type) can carry the handle and hand back a
typed spawner on demand via Self::downcast.
Implementations§
Source§impl AnyTaskSpawner
impl AnyTaskSpawner
Sourcepub fn new<T: Send + 'static>(spawner: &TaskSpawner<T>) -> Self
pub fn new<T: Send + 'static>(spawner: &TaskSpawner<T>) -> Self
Erase a typed spawner. Called by the shell when it wires tasks.
Sourcepub fn downcast<T: Send + 'static>(&self) -> Option<TaskSpawner<T>>
pub fn downcast<T: Send + 'static>(&self) -> Option<TaskSpawner<T>>
Recover the typed spawner. None if this handle was erased from a
different task type (a caller asking for the wrong T).
Trait Implementations§
Source§impl Clone for AnyTaskSpawner
impl Clone for AnyTaskSpawner
Source§fn clone(&self) -> AnyTaskSpawner
fn clone(&self) -> AnyTaskSpawner
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for AnyTaskSpawner
impl !UnwindSafe for AnyTaskSpawner
impl Freeze for AnyTaskSpawner
impl Send for AnyTaskSpawner
impl Sync for AnyTaskSpawner
impl Unpin for AnyTaskSpawner
impl UnsafeUnpin for AnyTaskSpawner
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