pub struct Stream { /* private fields */ }Expand description
A subscription to a single topic on a pool-backed pub/sub region.
Returns Sample references that implement Deref<Target=[u8]>.
These guards are safe – the block is held alive by atomic refcounting
until the guard is dropped.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn try_recv(&self) -> Option<Sample<'_>>
pub fn try_recv(&self) -> Option<Sample<'_>>
Non-blocking: returns the next sample guard or None.
The returned guard implements Deref<Target=[u8]> – safe to read
without unsafe. The block is held alive until the guard is dropped.
Uses a ring-window scan to handle multi-publisher scenarios where sequence numbers are claimed atomically and slots may be committed out of order.
Sourcepub fn try_recv_typed<T: Pod>(&self) -> Option<TypedSample<'_, T>>
pub fn try_recv_typed<T: Pod>(&self) -> Option<TypedSample<'_, T>>
Non-blocking typed receive. Returns a TypedSample that
dereferences to &T.
Uses the same ring-window scan as try_recv to
handle multi-publisher scenarios.
Returns None if no new data is available or if the topic’s
registered type size doesn’t match size_of::<T>().
Sourcepub fn recv_typed<T: Pod>(&self) -> Result<TypedSample<'_, T>, Error>
pub fn recv_typed<T: Pod>(&self) -> Result<TypedSample<'_, T>, Error>
Blocking typed receive with the default WaitStrategy.
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.
Sourcepub fn recv_typed_with<T: Pod>(
&self,
strategy: WaitStrategy,
) -> Result<TypedSample<'_, T>, Error>
pub fn recv_typed_with<T: Pod>( &self, strategy: WaitStrategy, ) -> Result<TypedSample<'_, T>, Error>
Blocking typed receive with a custom WaitStrategy.
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.
Sourcepub fn recv_with(&self, strategy: WaitStrategy) -> Result<Sample<'_>, Error>
pub fn recv_with(&self, strategy: WaitStrategy) -> Result<Sample<'_>, Error>
Blocking: waits for the next sample using the given WaitStrategy.
For BusySpin/YieldSpin/BackoffSpin: loops calling try_recv()
with the strategy’s wait hint, checking heartbeat periodically.
For Adaptive: uses spin/yield phases, then falls through to the
OS-assisted sleep path (futex/WaitOnAddress/WFE).
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.
Sourcepub fn recv(&self) -> Result<Sample<'_>, Error>
pub fn recv(&self) -> Result<Sample<'_>, Error>
Blocking: waits for the next sample using the default WaitStrategy
(three-phase adaptive: spin -> yield -> OS sleep).
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.
Sourcepub fn try_recv_pinned(&self) -> Option<PinnedGuard<'_>>
pub fn try_recv_pinned(&self) -> Option<PinnedGuard<'_>>
Non-blocking pinned receive. Returns a zero-overhead guard pointing directly into the pinned block.
The guard increments a shared reader count on creation and decrements
on drop. The publisher checks this count before writing – if any
readers exist, loan_pinned returns an error instead of causing UB.
Returns None if no new data has been published since the last recv.
Sourcepub fn recv_pinned(&self) -> Result<PinnedGuard<'_>, Error>
pub fn recv_pinned(&self) -> Result<PinnedGuard<'_>, Error>
Blocking pinned receive. Waits for the next pinned publish using
the default WaitStrategy (three-phase adaptive: spin -> yield
-> OS sleep).
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.
Sourcepub fn recv_pinned_with(
&self,
strategy: WaitStrategy,
) -> Result<PinnedGuard<'_>, Error>
pub fn recv_pinned_with( &self, strategy: WaitStrategy, ) -> Result<PinnedGuard<'_>, Error>
Blocking pinned receive with a custom WaitStrategy.
§Errors
Returns Error::PublisherDead if the publisher heartbeat goes stale.