[−][src]Struct multitask::LocalExecutor
A single-threaded executor.
Implementations
impl LocalExecutor
[src]
pub fn new(notify: impl Fn() + Send + Sync + 'static) -> LocalExecutor
[src]
Creates a new single-threaded executor.
Examples
use multitask::LocalExecutor; let (p, u) = parking::pair(); let ex = LocalExecutor::new(move || u.unpark());
pub fn spawn<T: 'static>(
&self,
future: impl Future<Output = T> + 'static
) -> Task<T>
[src]
&self,
future: impl Future<Output = T> + 'static
) -> Task<T>
Spawns a thread-local future onto this executor.
Returns a Task
handle for the spawned future.
Examples
use multitask::LocalExecutor; let (p, u) = parking::pair(); let ex = LocalExecutor::new(move || u.unpark()); let task = ex.spawn(async { println!("hello") });
pub fn tick(&self) -> bool
[src]
Runs a single task and returns true
if one was found.
Examples
use multitask::LocalExecutor; let (p, u) = parking::pair(); let ex = LocalExecutor::new(move || u.unpark()); assert!(!ex.tick()); let task = ex.spawn(async { println!("hello") }); // This prints "hello". assert!(ex.tick());
Trait Implementations
impl Debug for LocalExecutor
[src]
impl Drop for LocalExecutor
[src]
impl RefUnwindSafe for LocalExecutor
[src]
impl UnwindSafe for LocalExecutor
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,