pub struct Reader<T: Clone + Send> { /* private fields */ }Expand description
Owned, ergonomic handle over an erased BufferReader.
Returned by Consumer::subscribe. This is the “boxed lane”: one indirect
call per recv, zero AimDB-added heap allocations per message. (The generic
monomorphized Reader<T, B> fast lane remains dormant.)
Implementations§
Source§impl<T: Clone + Send> Reader<T>
impl<T: Clone + Send> Reader<T>
Sourcepub fn new(inner: Box<dyn BufferReader<T> + Send>) -> Self
pub fn new(inner: Box<dyn BufferReader<T> + Send>) -> Self
Wrap an erased reader in an ergonomic handle.
Sourcepub async fn recv(&mut self) -> Result<T, DbError>
pub async fn recv(&mut self) -> Result<T, DbError>
Receive the next value, awaiting until one is available.
Allocation-free: wraps the erased reader’s
poll_recv via core::future::poll_fn.
§Behavior by Buffer Type
- SPMC Ring: Returns next value, or
Lagged(n)if fell behind - SingleLatest: Waits for value change, returns most recent
- Mailbox: Waits for slot value, takes and clears it
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Reader<T>
impl<T> !Sync for Reader<T>
impl<T> !UnwindSafe for Reader<T>
impl<T> Freeze for Reader<T>
impl<T> Send for Reader<T>
impl<T> Unpin for Reader<T>
impl<T> UnsafeUnpin for Reader<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more