Skip to main content

DynBuffer

Trait DynBuffer 

Source
pub trait DynBuffer<T: Clone + Send>: Send + Sync {
    // Required methods
    fn push(&self, value: T);
    fn subscribe_boxed(&self) -> Box<dyn BufferReader<T> + Send>;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Dynamic buffer trait for trait objects (object-safe)

Type-erased interface for buffers that can be stored as trait objects. Automatically implemented for all Buffer<T> types via blanket impl.

Used when storing heterogeneous buffer types (e.g., in TypedRecord).

Required Methods§

Source

fn push(&self, value: T)

Push a value into the buffer (non-blocking)

Source

fn subscribe_boxed(&self) -> Box<dyn BufferReader<T> + Send>

Create a boxed reader for consuming values

Returns a type-erased reader. Each reader maintains its own position.

Source

fn as_any(&self) -> &dyn Any

Returns self as Any for downcasting to concrete buffer types

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§