pub enum ReplayStrategy {
Fifo,
ByToolName,
Exact,
}Expand description
Replay strategy: decides which recording a request takes in concurrent/out-of-order scenarios.
Variants§
Fifo
Concurrent FIFO: pops in recording order, atomic pop has no UB, but “which request gets which response” is not deterministic.
Suits serial/order-stable chains; parallel scenarios use order-independent assertions (only assert that replay is fully drained and each response is structurally non-empty), never “the Nth response is tool A’s”.
ByToolName
Routes by tool name: tools carry a name when bound (bind_tools), replay picks the first
recording in the queue whose tool name matches (request-side exchange.tools or
response-side tool_calls).
Covers parallel scenarios where “different tools return different responses and need exact correspondence” — each parallel branch binds its own tool and gets its own correct response. Weaker than full message-signature matching, but reproducible.
Exact
Matches the request messages by full signature: the request messages must be
element-wise exactly equal to exchange.messages (Message’s PartialEq over all
fields, including content / message_type / name / additional_kwargs / tool_calls).
Under parallel out-of-order traffic each request exactly gets its own response; a recording
with no match returns an explicit TestkitError::ReplayNoMatch, never a silent FIFO
fallback (which would disguise “wrong response” as success). Suits deterministic replays
where “the same message sequence always reproduces the same response” — any field drift
between the recording and the request (e.g. a runtime-assigned id that differs each time)
counts as no-match, so fixtures must keep those fields stable.
Trait Implementations§
Source§impl Clone for ReplayStrategy
impl Clone for ReplayStrategy
Source§fn clone(&self) -> ReplayStrategy
fn clone(&self) -> ReplayStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReplayStrategy
Source§impl Debug for ReplayStrategy
impl Debug for ReplayStrategy
Source§impl Default for ReplayStrategy
impl Default for ReplayStrategy
Source§fn default() -> ReplayStrategy
fn default() -> ReplayStrategy
impl Eq for ReplayStrategy
Source§impl PartialEq for ReplayStrategy
impl PartialEq for ReplayStrategy
impl StructuralPartialEq for ReplayStrategy
Auto Trait Implementations§
impl Freeze for ReplayStrategy
impl RefUnwindSafe for ReplayStrategy
impl Send for ReplayStrategy
impl Sync for ReplayStrategy
impl Unpin for ReplayStrategy
impl UnsafeUnpin for ReplayStrategy
impl UnwindSafe for ReplayStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.