pub struct MockTransport { /* private fields */ }Expand description
Scripted request/response transport for deterministic CI.
Implementations§
Source§impl MockTransport
impl MockTransport
pub fn from_script(steps: Vec<ScriptStep>) -> MockTransport
Sourcepub fn reopen(&self) -> MockTransport
pub fn reopen(&self) -> MockTransport
Returns a fresh transport replaying the same script (for new sessions).
pub fn script(&self) -> &[ScriptStep]
pub fn with_identity(self, identity: TransportIdentity) -> MockTransport
Sourcepub fn fail_writes(self, count: u32) -> MockTransport
pub fn fail_writes(self, count: u32) -> MockTransport
Fails the next N write attempts with Timeout (for retry testing).
Sourcepub fn fail_reads(self, count: u32) -> MockTransport
pub fn fail_reads(self, count: u32) -> MockTransport
Fails the next N read attempts with Timeout without consuming a script step.
Trait Implementations§
Source§impl Clone for MockTransport
impl Clone for MockTransport
Source§fn clone(&self) -> MockTransport
fn clone(&self) -> MockTransport
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockTransport
impl Debug for MockTransport
Source§impl Transport for MockTransport
impl Transport for MockTransport
fn write(&mut self, data: &[u8]) -> Result<(), Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
fn clear(&mut self) -> Result<(), Error>
fn set_read_timeout(&mut self, _timeout: Duration) -> Result<(), Error>
Source§fn identity(&self) -> TransportIdentity
fn identity(&self) -> TransportIdentity
Pre-SCPI identity hints. Default: empty.
Auto Trait Implementations§
impl Freeze for MockTransport
impl RefUnwindSafe for MockTransport
impl Send for MockTransport
impl Sync for MockTransport
impl Unpin for MockTransport
impl UnsafeUnpin for MockTransport
impl UnwindSafe for MockTransport
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