pub struct SubscriptionId { /* private fields */ }Expand description
An opaque handle identifying one subscription for as long as you hold it.
It survives everything the session does — a rebind, a recovery, and even a
replacement of the session by a new one. That is deliberate: the protocol’s
own subscription numbers are only unique within a session and restart at
one when a session is replaced [docs/spec/02-session-lifecycle.md §4.4],
so a caller given those numbers would see its subscriptions change identity
for reasons that have nothing to do with them.
§It names its client too
Every client numbers its own subscriptions from one, so the bare number is
only unique within one client. The handle therefore carries the identity of
the client that created it, and
Client::unsubscribe refuses one that came
from a different client with Error::ForeignSubscription. Two clients in
one process inevitably hand out the same numbers; without this they would
hand out interchangeable handles, and cancelling the wrong data would be
a plain type-checked call away.
Get one from Updates::id.
Implementations§
Source§impl SubscriptionId
impl SubscriptionId
Sourcepub const fn get(self) -> u64
pub const fn get(self) -> u64
An opaque number, for logging and for use as a map key.
Unique within one client: two clients each number their
subscriptions from one, so this alone does not identify a subscription
in a process that has more than one client. It is not the protocol’s
LS_subId and must not be sent anywhere.
Trait Implementations§
Source§impl Clone for SubscriptionId
impl Clone for SubscriptionId
Source§fn clone(&self) -> SubscriptionId
fn clone(&self) -> SubscriptionId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more