use commonware_actor::mailbox; use commonware_runtime::Metrics; use std::num::NonZeroUsize; /// A mailbox wraps a sender for messages of type `T`. #[derive(Debug)] pub struct Mailbox(pub(crate) mailbox::UnreliableSender); impl Mailbox { /// Returns a new mailbox with the given sender. pub fn new( metrics: impl Metrics, size: NonZeroUsize, ) -> (Self, mailbox::UnreliableReceiver) { let (sender, receiver) = mailbox::new_unreliable(metrics, size); (Self(sender), receiver) } } impl Clone for Mailbox { fn clone(&self) -> Self { Self(self.0.clone()) } }