//! Mock sender implementations for testing. use commonware_actor::{Feedback, Unreliable}; use commonware_cryptography::PublicKey; use commonware_p2p::{CheckedSender, LimitedSender, Recipients}; use commonware_runtime::IoBufs; use std::time::SystemTime; /// A sender that always returns [Feedback::Closed]. #[derive(Clone, Debug)] pub struct Failing { _phantom: std::marker::PhantomData

, } impl Failing

{ /// Creates a new failing sender. pub fn new() -> Self { Self { _phantom: std::marker::PhantomData, } } } impl LimitedSender for Failing

{ type PublicKey = P; type Checked<'a> = CheckedFailing

; fn check(&mut self, _recipients: Recipients

) -> Result, SystemTime> { Ok(CheckedFailing { _phantom: std::marker::PhantomData, }) } } pub struct CheckedFailing { _phantom: std::marker::PhantomData

, } impl CheckedSender for CheckedFailing

{ type PublicKey = P; fn recipients(&self) -> Vec { Vec::new() } fn send(self, _message: impl Into + Send, _priority: bool) -> Unreliable { Unreliable::new(Feedback::Closed) } }