pub struct AnyTaskSpawner(/* private fields */);Expand description
A bundle of type-erased TaskSpawners - one lane per declared task
type - so the concrete ProcessContext / InitContext (whose
signatures are fixed by the leaf trait and can’t name the plugin’s task
types) can carry every lane and hand back the right typed spawner on
demand via Self::downcast. Cheap to clone (one Arc).
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 single typed spawner into a one-lane bundle.
Sourcepub fn from_lanes(lanes: Vec<Arc<dyn Any + Send + Sync>>) -> Self
pub fn from_lanes(lanes: Vec<Arc<dyn Any + Send + Sync>>) -> Self
Bundle several already-erased lanes (one per task type). The
plugin! macro builds the lanes with TaskSpawnerBundle.
Sourcepub fn downcast<T: Send + 'static>(&self) -> Option<TaskSpawner<T>>
pub fn downcast<T: Send + 'static>(&self) -> Option<TaskSpawner<T>>
Recover the typed spawner for task type T, or None if no lane of
that type was declared. Lanes have distinct types, so at most one
matches.
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