pub struct Faulty<T> { /* private fields */ }Expand description
Wraps a Transport and fails a configurable number of upcoming sends.
This simulates an intermittent link so offline-first behavior can be proven rather than assumed: pair it with a store-and-forward drain and assert that every record still arrives, in order, once the link recovers.
§Examples
use pamoja_core::Transport;
use pamoja_loopback::{Faulty, LoopbackBroker, LoopbackTransport};
let broker = LoopbackBroker::new();
let mut node = Faulty::new(LoopbackTransport::new(broker), 1);
node.connect().await?;
// The first send fails, simulating a dropped link; the next succeeds.
assert!(node.send("t", b"x").await.is_err());
node.send("t", b"x").await?;Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Faulty<T>where
T: Freeze,
impl<T> RefUnwindSafe for Faulty<T>where
T: RefUnwindSafe,
impl<T> Send for Faulty<T>where
T: Send,
impl<T> Sync for Faulty<T>where
T: Sync,
impl<T> Unpin for Faulty<T>where
T: Unpin,
impl<T> UnsafeUnpin for Faulty<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Faulty<T>where
T: UnwindSafe,
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