pub struct TraceBackend<B: Backend> { /* private fields */ }Expand description
A Backend that stores the incoming requests to be later retrieved by the test. Delegates the response generation to the function provided in the constructor. This classes uses the interior mutability pattern to allow the test to retrieve the requests.
§Example
ⓘ
let back = Rc::new(TraceBackend::new(echo_backend));
let mut tester = UnitTestBuilder::default()
.with_config(config)
.with_backend(Rc::clone(&back))
.with_entrypoint(crate::configure);
let response = tester.request(req.clone());
let request = back.next().unwrap();Implementations§
Source§impl<B: Backend> TraceBackend<B>
impl<B: Backend> TraceBackend<B>
Trait Implementations§
Source§impl<B: Backend> Backend for TraceBackend<B>
impl<B: Backend> Backend for TraceBackend<B>
fn call(&self, req: UnitHttpRequest) -> UnitHttpResponse
Auto Trait Implementations§
impl<B> !Freeze for TraceBackend<B>
impl<B> !RefUnwindSafe for TraceBackend<B>
impl<B> !Send for TraceBackend<B>
impl<B> !Sync for TraceBackend<B>
impl<B> Unpin for TraceBackend<B>where
B: Unpin,
impl<B> UnsafeUnpin for TraceBackend<B>where
B: UnsafeUnpin,
impl<B> !UnwindSafe for TraceBackend<B>
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