[][src]Struct httptest::ExpectationBuilder

pub struct ExpectationBuilder { /* fields omitted */ }

Define expectations using a builder pattern.

Implementations

impl ExpectationBuilder[src]

pub fn times<R>(self, times: R) -> ExpectationBuilder where
    R: IntoTimes, 
[src]

Expect this many requests.

// exactly 2 requests
Expectation::matching(any()).times(2).respond_with(status_code(200));
// at least 2 requests
Expectation::matching(any()).times(2..).respond_with(status_code(200));
// at most 2 requests
Expectation::matching(any()).times(..=2).respond_with(status_code(200));
// between 2 and 5 inclusive
Expectation::matching(any()).times(2..6).respond_with(status_code(200));
// equivalently
Expectation::matching(any()).times(2..=5).respond_with(status_code(200));

pub fn respond_with(self, responder: impl Responder + 'static) -> Expectation[src]

What should this expectation respond with.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.