fuchsia_backoff

Trait 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>>,

Source§

type Ok = T

Source§

type Error = E

Source§

type Future = Fut