Trait async_hal::delay::DelayMs

source ·
pub trait DelayMs {
    type Delay;
    type Error;

    // Required methods
    fn start(&mut self, ms: Self::Delay) -> Result<(), Self::Error>;
    fn poll_delay_ms(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Self::Error>>;
    fn cancel(&mut self) -> Result<(), Self::Error>;

    // Provided methods
    fn poll_delay_ms_unpin(
        &mut self,
        cx: &mut Context<'_>
    ) -> Poll<Result<(), Self::Error>>
       where Self: Unpin { ... }
    fn delay_ms(&mut self, ms: Self::Delay) -> DelayMsFuture<'_, Self> 
       where Self: Unpin { ... }
}

Required Associated Types§

source

type Delay

The type of duration to delay for.

source

type Error

The error returned on failure.

Required Methods§

source

fn start(&mut self, ms: Self::Delay) -> Result<(), Self::Error>

Start a new delay.

source

fn poll_delay_ms( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>

Poll a delay of ms milliseconds.

source

fn cancel(&mut self) -> Result<(), Self::Error>

Attempt to cancel a delay in progress.

Provided Methods§

source

fn poll_delay_ms_unpin( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>where Self: Unpin,

source

fn delay_ms(&mut self, ms: Self::Delay) -> DelayMsFuture<'_, Self> where Self: Unpin,

Delay for ms milliseconds. Starts a new delay and returns a Future that completes when either the timer expires. The returned future also implements [Stream] if this delay is Periodic.

When dropped, this future will attempt to cancel the current delay.

Implementors§

source§

impl<T, S> DelayMs for Timer<T, S>where T: CountDown + Cancel + Unpin, T::Time: From<MillisDurationU32>, S: Scheduler + Unpin,

§

type Delay = u32

§

type Error = <T as Cancel>::Error