use crate::authenticated::{discovery::types, Mailbox}; use commonware_cryptography::PublicKey; use commonware_utils::channels::fallible::AsyncFallibleExt; /// Messages that can be sent to the peer [super::Actor]. #[derive(Clone, Debug)] pub enum Message { /// Send a bit vector to the peer. BitVec(types::BitVec), /// Send a list of [types::Info] to the peer. Peers(Vec>), /// Kill the peer actor. Kill, } impl Mailbox> { pub async fn bit_vec(&mut self, bit_vec: types::BitVec) { self.0.send_lossy(Message::BitVec(bit_vec)).await; } pub async fn peers(&mut self, peers: Vec>) { self.0.send_lossy(Message::Peers(peers)).await; } pub async fn kill(&mut self) { self.0.send_lossy(Message::Kill).await; } }