Struct single_executor::SleepFutureRunner[][src]

pub struct SleepFutureRunner<Q, CS> where
    CS: TryThreadSpawner<()>, 
{ /* fields omitted */ }
Expand description

Runs asynchronous sleep functions by launching a separate handler thread. Each new instance of this spawns a thread.

Implementations

impl<'a, Q, CS> SleepFutureRunner<Q, CS> where
    Q: 'static + TimeoutQueue<Item = SleepMessage<CS>> + Send + Sync,
    CS: TryThreadSpawner<()> + TimeFunctions
[src]

pub fn try_new(queue: Q) -> Result<Self, CS::SpawnError>[src]

Tries to create a new SleepFutureRunner by launching a thread.

pub fn new(queue: Q) -> Self where
    CS: ThreadSpawner<()>, 
[src]

Create a new SleepFutureRunner by launching a thread. Requires thread spawning to be infallible.

pub fn sleep_for(&self, time: Duration) -> SleepFuture

Notable traits for SleepFuture

impl Future for SleepFuture type Output = ();
[src]

Creates a future that sleeps for a given duration from this call.

pub fn sleep_until(&self, instant: CS::InstantType) -> SleepFuture

Notable traits for SleepFuture

impl Future for SleepFuture type Output = ();
[src]

Creates a future that sleeps until a given CS::InstantType.

pub fn thread_handle(&self) -> &CS::ThreadHandle[src]

Gets a shared reference to the CS::ThreadHandle that is running the sleep operations.

pub fn into_thread_handle(self) -> CS::ThreadHandle[src]

Converts this runner into a . If this is the last runner for this thread then the thread will stop soon.

Trait Implementations

impl<Q: Debug, CS: Debug> Debug for SleepFutureRunner<Q, CS> where
    CS: TryThreadSpawner<()>,
    CS::ThreadHandle: Debug
[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<Q, CS> RefUnwindSafe for SleepFutureRunner<Q, CS> where
    Q: RefUnwindSafe,
    <CS as TryThreadSpawner<()>>::ThreadHandle: RefUnwindSafe

impl<Q, CS> Send for SleepFutureRunner<Q, CS> where
    Q: Send + Sync,
    <CS as TryThreadSpawner<()>>::ThreadHandle: Send

impl<Q, CS> Sync for SleepFutureRunner<Q, CS> where
    Q: Send + Sync,
    <CS as TryThreadSpawner<()>>::ThreadHandle: Sync

impl<Q, CS> Unpin for SleepFutureRunner<Q, CS> where
    <CS as TryThreadSpawner<()>>::ThreadHandle: Unpin

impl<Q, CS> UnwindSafe for SleepFutureRunner<Q, CS> where
    Q: RefUnwindSafe,
    <CS as TryThreadSpawner<()>>::ThreadHandle: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.