use tokio::sync::mpsc; use super::{ClientCommand, ClientEvent}; pub struct ClientPort { pub commands: mpsc::Receiver, pub events: mpsc::Sender, } pub struct ClientSession { pub commands: mpsc::Sender, pub events: mpsc::Receiver, } pub fn session(capacity: usize) -> (ClientPort, ClientSession) { let (commands_tx, commands_rx) = mpsc::channel(capacity); let (events_tx, events_rx) = mpsc::channel(capacity); ( ClientPort { commands: commands_rx, events: events_tx, }, ClientSession { commands: commands_tx, events: events_rx, }, ) }