[][src]Trait adventure::Request

pub trait Request<C>: BaseRequest {
    type Response: Response<Ok = Self::Ok, Error = Self::Error>;
    fn send(self: Pin<&mut Self>, client: C) -> Self::Response;

    fn oneshot(self) -> Oneshot<Self>
    where
        Self: Sized
, { ... }
fn retry_if<F>(self, pred: F) -> RetryingTokio<Self, ExponentialBackoff, F>
    where
        Self: Sized,
        F: RetrialPredicate<Self>
, { ... }
fn retry_with_config<T, B, F>(
        self,
        timer: T,
        pred: F,
        backoff: B
    ) -> Retrying<Self, T, B, F>
    where
        Self: Sized,
        T: Timer + Unpin,
        B: Backoff,
        F: RetrialPredicate<Self>
, { ... } }

A generalized request-response interface, regardless how client works.

Because that the type of a client is parametrized, it can be implemented to work with various kind of clients for the same type of the request.

Associated Types

type Response: Response<Ok = Self::Ok, Error = Self::Error>

The type of corresponding responses of this request.

Loading content...

Required methods

fn send(self: Pin<&mut Self>, client: C) -> Self::Response

Loading content...

Provided methods

fn oneshot(self) -> Oneshot<Self> where
    Self: Sized

fn retry_if<F>(self, pred: F) -> RetryingTokio<Self, ExponentialBackoff, F> where
    Self: Sized,
    F: RetrialPredicate<Self>, 

Wrap this request to retry if the given predicate returns true.

It should be called within the tokio execution context, because the default timer is implemented using tokio_timer.

fn retry_with_config<T, B, F>(
    self,
    timer: T,
    pred: F,
    backoff: B
) -> Retrying<Self, T, B, F> where
    Self: Sized,
    T: Timer + Unpin,
    B: Backoff,
    F: RetrialPredicate<Self>, 

Wrap this request to retry with customizable options, including the timer implementation.

Loading content...

Implementations on Foreign Types

impl<P, C> Request<C> for Pin<P> where
    P: DerefMut + Unpin,
    <P as Deref>::Target: Request<C>, 
[src]

type Response = <<P as Deref>::Target as Request<C>>::Response

impl<R, C> Request<C> for Box<R> where
    R: Request<C>, 
[src]

type Response = R::Response

Loading content...

Implementors

impl<R, C> Request<C> for Repeat<R> where
    R: OneshotRequest<C> + Clone
[src]

type Response = R::Response

impl<R, T, B, F, C> Request<C> for Retrying<R, T, B, F> where
    Self: RetryMethod<C, Response = R::Response> + Clone + Unpin,
    R: Request<C>,
    R::Response: Unpin,
    C: Clone
[src]

type Response = Retrial<Self, C>

Loading content...