pub struct Asserter { /* private fields */ }
Expand description
Container for pushing responses into a MockTransport
.
Mock responses are stored and returned with a FIFO queue.
See the module documentation.
Implementations§
Source§impl Asserter
impl Asserter
Sourcepub fn push(&self, response: MockResponse)
pub fn push(&self, response: MockResponse)
Push a response into the queue.
Sourcepub fn push_success<R: Serialize>(&self, response: &R)
pub fn push_success<R: Serialize>(&self, response: &R)
Sourcepub fn push_failure(&self, error: ErrorPayload)
pub fn push_failure(&self, error: ErrorPayload)
Push an error payload into the queue.
Sourcepub fn push_failure_msg(&self, msg: impl Into<Cow<'static, str>>)
pub fn push_failure_msg(&self, msg: impl Into<Cow<'static, str>>)
Push an internal error message into the queue.
Sourcepub fn pop_response(&self) -> Option<MockResponse>
pub fn pop_response(&self) -> Option<MockResponse>
Pops the next mock response.
Sourcepub fn read_q(&self) -> impl Deref<Target = VecDeque<MockResponse>> + '_
pub fn read_q(&self) -> impl Deref<Target = VecDeque<MockResponse>> + '_
Returns a read lock guard to the responses queue.
Sourcepub fn write_q(&self) -> impl DerefMut<Target = VecDeque<MockResponse>> + '_
pub fn write_q(&self) -> impl DerefMut<Target = VecDeque<MockResponse>> + '_
Returns a write lock guard to the responses queue.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Asserter
impl RefUnwindSafe for Asserter
impl Send for Asserter
impl Sync for Asserter
impl Unpin for Asserter
impl UnwindSafe for Asserter
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