Skip to main content

BufferReader

Trait BufferReader 

Source
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§

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Return this reader as Any for runtime downcasting.

Source

fn init(&mut self, block_id: BlockId, port_id: PortId, inbox: BlockInbox)

Initialize the reader with its owning block, port id, and inbox.

Source

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.

Source

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.

Source

fn finish(&mut self)

Mark this reader because the upstream writer is done.

Source

fn finished(&self) -> bool

Return whether the upstream writer has marked this buffer as done.

Source

fn block_id(&self) -> BlockId

Get the owning block id.

Source

fn port_id(&self) -> PortId

Get the owning port id.

Implementors§

Source§

impl<D> BufferReader for futuresdr::runtime::buffer::circular::Reader<D>
where D: CpuSample,

Source§

impl<T> BufferReader for futuresdr::runtime::buffer::circuit::Reader<T>
where T: CpuSample,

Source§

impl<T: Debug + Send + 'static> BufferReader for futuresdr::runtime::mocker::Reader<T>