Trait fuchsia_backoff::Task

source ·
pub trait Task {
    type Ok;
    type Error;
    type Future: Future<Output = Result<Self::Ok, Self::Error>>;

    // Required method
    fn run(&mut self) -> Self::Future;
}
Expand description

A task produces an asynchronous computation that can be retried if the returned future fails with some error.

Required Associated Types§

source

type Ok

The type of successful values yielded by the task future.

source

type Error

The type of failures yielded by the task future.

source

type Future: Future<Output = Result<Self::Ok, Self::Error>>

The future returned when executing this task.

Required Methods§

source

fn run(&mut self) -> Self::Future

Return a future.

Implementors§

source§

impl<F, Fut, T, E> Task for F
where F: FnMut() -> Fut, Fut: Future<Output = Result<T, E>>,

§

type Ok = T

§

type Error = E

§

type Future = Fut