pub struct AnyLocalExecutor(/* private fields */);
Expand description
A type-erased LocalExecutor
that can hold any local executor implementation.
This allows for runtime selection of executors and storing different executor types in the same collection.
Implementations§
Source§impl AnyLocalExecutor
impl AnyLocalExecutor
Sourcepub fn new(executor: impl LocalExecutor + 'static) -> Self
pub fn new(executor: impl LocalExecutor + 'static) -> Self
Create a new AnyLocalExecutor
wrapping the given local executor.
Sourcepub fn downcast_ref<E: LocalExecutor + 'static>(&self) -> Option<&E>
pub fn downcast_ref<E: LocalExecutor + 'static>(&self) -> Option<&E>
Attempt to downcast to a concrete local executor type by reference.
Returns Some(&E)
if the underlying executor is of type E
, None
otherwise.
Sourcepub fn downcast<E: LocalExecutor + 'static>(self) -> Result<Box<E>, Self>
pub fn downcast<E: LocalExecutor + 'static>(self) -> Result<Box<E>, Self>
Attempt to downcast to a concrete local executor type by value.
Returns Ok(Box<E>)
if the underlying executor is of type E
,
Err(Self)
otherwise (returning the original AnyLocalExecutor
).
Trait Implementations§
Source§impl Debug for AnyLocalExecutor
impl Debug for AnyLocalExecutor
Source§impl LocalExecutor for AnyLocalExecutor
impl LocalExecutor for AnyLocalExecutor
Auto Trait Implementations§
impl Freeze for AnyLocalExecutor
impl !RefUnwindSafe for AnyLocalExecutor
impl !Send for AnyLocalExecutor
impl !Sync for AnyLocalExecutor
impl Unpin for AnyLocalExecutor
impl !UnwindSafe for AnyLocalExecutor
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