pub trait BufferReader: Any {
// Required methods
fn as_any_mut(&mut self) -> &mut dyn Any;
fn init(&mut self, block_id: BlockId, port_id: PortId, inbox: BlockInbox);
fn validate(&self) -> Result<(), Error>;
fn notify_finished(&mut self) -> impl Future<Output = ()>
where Self: Sized;
fn finish(&mut self);
fn finished(&self) -> bool;
fn block_id(&self) -> BlockId;
fn port_id(&self) -> PortId;
}Expand description
Type-erased reader side of a stream buffer.
This is the primary local API. Native send-capable readers are derived from this trait through a blanket impl when the type and returned futures permit it.
Required Methods§
Sourcefn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Return this reader as Any for runtime downcasting.
Sourcefn init(&mut self, block_id: BlockId, port_id: PortId, inbox: BlockInbox)
fn init(&mut self, block_id: BlockId, port_id: PortId, inbox: BlockInbox)
Initialize the reader with its owning block, port id, and inbox.
Sourcefn validate(&self) -> Result<(), Error>
fn validate(&self) -> Result<(), Error>
Validate that this reader is connected and ready to run.
The runtime calls this during flowgraph startup before any block init()
method runs.
Sourcefn notify_finished(&mut self) -> impl Future<Output = ()>where
Self: Sized,
fn notify_finished(&mut self) -> impl Future<Output = ()>where
Self: Sized,
Notify upstream writers that this reader is done.
Implementations usually forward this signal through the peer
BlockInbox so the upstream block can stop producing to this port.