[][src]Trait waiter::Waiter

pub trait Waiter<T, E> {
    fn default_wait_timeout(&self) -> Option<Duration>;
fn default_delay(&self) -> Duration;
fn poll(&mut self) -> Result<Option<T>, E>;
fn timeout_error(&self) -> E; fn wait(self) -> Result<T, E>
    where
        Self: Sized
, { ... }
fn wait_for(self, duration: Duration) -> Result<T, E>
    where
        Self: Sized
, { ... }
fn wait_for_with_delay(
        self,
        duration: Duration,
        delay: Duration
    ) -> Result<T, E>
    where
        Self: Sized
, { ... }
fn wait_forever(self) -> Result<T, E>
    where
        Self: Sized
, { ... }
fn wait_forever_with_delay(self, delay: Duration) -> Result<T, E>
    where
        Self: Sized
, { ... } }

Trait representing a waiter for some asynchronous action to finish.

The type T is the final type of the action, E is an error.

Required methods

fn default_wait_timeout(&self) -> Option<Duration>

Default timeout for this action.

This timeout is used in the wait method. If `None, wait forever by default.

fn default_delay(&self) -> Duration

Default delay between two retries.

fn poll(&mut self) -> Result<Option<T>, E>

Update the current state of the action.

Returns T if the action is finished, None if it is not. All errors are propagated via the Result.

This method should not be called again after it returned the final result.

fn timeout_error(&self) -> E

Error to return on timeout.

Loading content...

Provided methods

fn wait(self) -> Result<T, E> where
    Self: Sized

Wait for the default amount of time.

Consumes the Waiter. Returns OperationTimedOut if the timeout is reached.

fn wait_for(self, duration: Duration) -> Result<T, E> where
    Self: Sized

Wait for specified amount of time.

Returns OperationTimedOut if the timeout is reached.

fn wait_for_with_delay(
    self,
    duration: Duration,
    delay: Duration
) -> Result<T, E> where
    Self: Sized

Wait for specified amount of time.

fn wait_forever(self) -> Result<T, E> where
    Self: Sized

Wait forever.

fn wait_forever_with_delay(self, delay: Duration) -> Result<T, E> where
    Self: Sized

Wait forever with given delay between attempts.

Loading content...

Implementors

Loading content...