pub struct FetchMock { /* private fields */ }Expand description
Canned responses, the recorded calls, and the strict flag.
Implementations§
Source§impl FetchMock
impl FetchMock
Sourcepub fn add(&mut self, rule: FetchRule)
pub fn add(&mut self, rule: FetchRule)
Adds a rule; rules are tried in the order they were added.
Sourcepub fn set_strict(&mut self, strict: bool)
pub fn set_strict(&mut self, strict: bool)
Whether an unmatched request is refused instead of sent.
Sourcepub fn calls(&self) -> impl Iterator<Item = &FetchCall>
pub fn calls(&self) -> impl Iterator<Item = &FetchCall>
The calls recorded so far, oldest first.
Sourcepub fn dropped(&self) -> u64
pub fn dropped(&self) -> u64
How many of the oldest calls were dropped past
MAX_RECORDED_CALLS.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FetchMock
impl RefUnwindSafe for FetchMock
impl Send for FetchMock
impl Sync for FetchMock
impl Unpin for FetchMock
impl UnsafeUnpin for FetchMock
impl UnwindSafe for FetchMock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more