Trait brw::reader::Reader [−][src]
pub trait Reader: Sized { type BrokerItem: Send + 'static; type Ok: Send; type Error: Error + Send; fn op<'life0, 'async_trait, B>(
&'life0 mut self,
broker: B
) -> Pin<Box<dyn Future<Output = Running<Result<Self::Ok, Self::Error>>> + Send + 'async_trait>>
where
B: Sink<Self::BrokerItem, Error = SendError<Self::BrokerItem>> + Send + Unpin,
B: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait; fn handle_result<'async_trait>(
res: Result<Self::Ok, Self::Error>
) -> Pin<Box<dyn Future<Output = Running<()>> + Send + 'async_trait>>
where
Self: Send + 'async_trait, { ... } fn reader_loop<'async_trait, B>(
self,
ctx: Arc<Context<Self::BrokerItem>>,
broker: B,
stop: Receiver<()>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
B: Sink<Self::BrokerItem, Error = SendError<Self::BrokerItem>> + Send + Unpin,
B: 'async_trait,
Self: Send + 'async_trait, { ... } }
Expand description
Reader of the broker-reader-writer pattern
Associated Types
type BrokerItem: Send + 'static
type BrokerItem: Send + 'static
Item to send to broker
Required methods
The operation to perform
Provided methods
Handles the result of each op
Returns a None
to stop the whole loop
fn reader_loop<'async_trait, B>(
self,
ctx: Arc<Context<Self::BrokerItem>>,
broker: B,
stop: Receiver<()>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
B: Sink<Self::BrokerItem, Error = SendError<Self::BrokerItem>> + Send + Unpin,
B: 'async_trait,
Self: Send + 'async_trait,
fn reader_loop<'async_trait, B>(
self,
ctx: Arc<Context<Self::BrokerItem>>,
broker: B,
stop: Receiver<()>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
B: Sink<Self::BrokerItem, Error = SendError<Self::BrokerItem>> + Send + Unpin,
B: 'async_trait,
Self: Send + 'async_trait,
Runs the operation in a loop