Trait brw::broker::Broker [−][src]
pub trait Broker: Sized { type Item: Send + 'static; type WriterItem: Send + 'static; type Ok: Send; type Error: Error + Send; fn op<'life0, 'life1, 'async_trait, W>(
&'life0 mut self,
ctx: &'life1 Arc<Context<Self::Item>>,
item: Self::Item,
writer: W
) -> Pin<Box<dyn Future<Output = Running<Result<Self::Ok, Self::Error>>> + Send + 'async_trait>>
where
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
W: 'async_trait,
'life0: 'async_trait,
'life1: '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 broker_loop<'async_trait, S, W, H>(
self,
items: S,
writer: W,
ctx: Arc<Context<Self::Item>>,
stop: Receiver<()>,
reader_handle: H,
writer_handle: H
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where
S: Stream<Item = Self::Item> + Send + Unpin,
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
H: Conclude + Send,
S: 'async_trait,
W: 'async_trait,
H: 'async_trait,
Self: Send + 'async_trait, { ... } }
Expand description
Broker of the broker-reader-writer pattern
Associated Types
type WriterItem: Send + 'static
type WriterItem: Send + 'static
Item sent to the writer
Required methods
fn op<'life0, 'life1, 'async_trait, W>(
&'life0 mut self,
ctx: &'life1 Arc<Context<Self::Item>>,
item: Self::Item,
writer: W
) -> Pin<Box<dyn Future<Output = Running<Result<Self::Ok, Self::Error>>> + Send + 'async_trait>> where
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
W: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn op<'life0, 'life1, 'async_trait, W>(
&'life0 mut self,
ctx: &'life1 Arc<Context<Self::Item>>,
item: Self::Item,
writer: W
) -> Pin<Box<dyn Future<Output = Running<Result<Self::Ok, Self::Error>>> + Send + 'async_trait>> where
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
W: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
The operation to perform
Provided methods
Handles the result of each op
Returns a None
to stop the whole loop
fn broker_loop<'async_trait, S, W, H>(
self,
items: S,
writer: W,
ctx: Arc<Context<Self::Item>>,
stop: Receiver<()>,
reader_handle: H,
writer_handle: H
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
S: Stream<Item = Self::Item> + Send + Unpin,
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
H: Conclude + Send,
S: 'async_trait,
W: 'async_trait,
H: 'async_trait,
Self: Send + 'async_trait,
fn broker_loop<'async_trait, S, W, H>(
self,
items: S,
writer: W,
ctx: Arc<Context<Self::Item>>,
stop: Receiver<()>,
reader_handle: H,
writer_handle: H
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
S: Stream<Item = Self::Item> + Send + Unpin,
W: Sink<Self::WriterItem, Error = SendError<Self::WriterItem>> + Send + Unpin,
H: Conclude + Send,
S: 'async_trait,
W: 'async_trait,
H: 'async_trait,
Self: Send + 'async_trait,
Runs the operation in a loop