pub struct Subscribable<T: Pod> { /* private fields */ }Expand description
Clone-able handle for spawning Subscribers.
Send this to other threads and call subscribe
to create independent consumers.
Implementations§
Source§impl<T: Pod> Subscribable<T>
impl<T: Pod> Subscribable<T>
Sourcepub fn subscribe(&self) -> Subscriber<T>
pub fn subscribe(&self) -> Subscriber<T>
Create a subscriber that will see only future messages.
Sourcepub fn subscribe_group<const N: usize>(&self) -> SubscriberGroup<T, N>
pub fn subscribe_group<const N: usize>(&self) -> SubscriberGroup<T, N>
Create a SubscriberGroup of N subscribers starting from the next
message. All N logical subscribers share a single ring read — the
seqlock is checked once and all cursors are advanced together.
This is dramatically faster than N independent Subscribers when
polled in a loop on the same thread.
§Panics
Panics if N is 0.
Sourcepub fn subscribe_from_oldest(&self) -> Subscriber<T>
pub fn subscribe_from_oldest(&self) -> Subscriber<T>
Create a subscriber starting from the oldest available message still in the ring (or 0 if nothing published yet).
Sourcepub fn subscribe_tracked(&self) -> Subscriber<T>
pub fn subscribe_tracked(&self) -> Subscriber<T>
Create a subscriber with an active cursor tracker.
Use this when the subscriber will participate in a
[DependencyBarrier] as an upstream consumer.
On bounded channels, this behaves identically to
subscribe() — those subscribers already have
trackers.
On lossy channels, subscribe() omits the
tracker (zero overhead for the common case). This method creates a
standalone tracker so that a [DependencyBarrier] can read the
subscriber’s cursor position. The tracker is not registered
with the ring’s backpressure system — it is purely for dependency
graph coordination.