use futures::sync::mpsc; use super::CancelReason; pub type ConsumerMessageRx = mpsc::UnboundedReceiver>; pub type ConsumerMessageTx = mpsc::UnboundedSender>; pub type ConsumerEventRx = mpsc::UnboundedReceiver; pub type ConsumerEventTx = mpsc::UnboundedSender; #[derive(Debug)] pub enum ConsumerMessage { Write(T), End, } #[derive(PartialEq, Clone, Debug)] pub enum ConsumerEvent { Request(usize), Cancellation(CancelReason), } pub trait Consumer { fn write(&self, data: T); fn end(&self); fn event_stream(&mut self) -> Option; fn set_event_stream(&mut self, event_stream: ConsumerEventRx); }