pub trait Buffer<T: Clone + Send>:
Send
+ Sync
+ 'static {
type Reader: BufferReader<T> + 'static;
// Required methods
fn new(cfg: &BufferCfg) -> Self
where Self: Sized;
fn push(&self, value: T);
fn subscribe(&self) -> Self::Reader;
}Expand description
Static buffer trait for concrete implementations
Provides push/subscribe operations for typed buffers. Readers are owned and can outlive the subscription call (required for spawned tasks).
Trait bounds ensure thread-safety and 'static lifetime for async runtimes.
See aimdb_tokio_adapter::TokioRingBuffer for implementation example.
Required Associated Types§
Sourcetype Reader: BufferReader<T> + 'static
type Reader: BufferReader<T> + 'static
Reader type for consuming values
Each subscribe() call returns an independent owned reader.
Required Methods§
Sourcefn new(cfg: &BufferCfg) -> Selfwhere
Self: Sized,
fn new(cfg: &BufferCfg) -> Selfwhere
Self: Sized,
Creates a new buffer with the given configuration
§Panics
May panic if configuration is invalid (call cfg.validate() first)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".