pub struct ScriptedUpstream { /* private fields */ }Expand description
An in-process Upstream that serves a fixed script of responses in order.
This is the seam that keeps replay tests offline: instead of a network provider, a re-run’s
cache-miss relays are answered from a queue the test set up. It hands out responses in FIFO
order and reports UpstreamError::Exhausted once the script runs dry, so a test that
under-scripts fails loudly rather than serving a stale answer.
Implementations§
Source§impl ScriptedUpstream
impl ScriptedUpstream
Sourcepub fn new(responses: impl IntoIterator<Item = CapturedResponse>) -> Self
pub fn new(responses: impl IntoIterator<Item = CapturedResponse>) -> Self
A stub that will serve responses in order on successive cache misses.
Trait Implementations§
Source§impl Debug for ScriptedUpstream
impl Debug for ScriptedUpstream
Source§impl Upstream for ScriptedUpstream
impl Upstream for ScriptedUpstream
Source§fn send(
&self,
_request: &CapturedRequest,
) -> impl Future<Output = Result<CapturedResponse, UpstreamError>> + Send
fn send( &self, _request: &CapturedRequest, ) -> impl Future<Output = Result<CapturedResponse, UpstreamError>> + Send
Send
request upstream and return the response. Read moreAuto Trait Implementations§
impl !Freeze for ScriptedUpstream
impl RefUnwindSafe for ScriptedUpstream
impl Send for ScriptedUpstream
impl Sync for ScriptedUpstream
impl Unpin for ScriptedUpstream
impl UnsafeUnpin for ScriptedUpstream
impl UnwindSafe for ScriptedUpstream
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