pub struct SubGuard { /* private fields */ }Expand description
Binding-layer RAII subscription handle (S2b / D225 / D234). The
core-level RAII Subscription was retired (a parameterless Drop
can’t reach a relocating owned Core); this wrapper IS the
sanctioned binding-layer replacement for substrate operators that
manage an inner subscription’s lifetime by ownership (higher-order
switch/exhaust/merge/concat_map inner subs). It holds a
ProducerEmitter (an Arc<CoreMailbox> — Send + Sync, 'static,
NOT the Core), so its Drop legitimately posts a deferred
unsubscribe via em.defer (owner-side, in-wave, FIFO-ordered —
D234). FIFO ordering gives the correct cancel-then-resubscribe
semantics: a SubGuard dropped before a new subscribe is posted is
drained (unsub) before the new subscribe. A Core-gone post is
dropped unrun (subscription moot at teardown — no leak).
Implementations§
Source§impl SubGuard
impl SubGuard
Sourcepub fn new(node: NodeId, sub: SubscriptionId, em: ProducerEmitter) -> Self
pub fn new(node: NodeId, sub: SubscriptionId, em: ProducerEmitter) -> Self
Track sub (returned by CoreFull::try_subscribe on node) so
dropping this guard unsubscribes it.