pub struct ConnectionId(pub usize);server only.Expand description
Connection ID.
Tuple Fields§
§0: usizeImplementations§
Source§impl ConnectionId
impl ConnectionId
Sourcepub const IN_PROCESS: Self
pub const IN_PROCESS: Self
Owner of subscriptions created by in-process calls such as
Methods::raw_json_request.
Servers count connections upwards from zero and never reach this value, so no transport connection can unsubscribe an in-process subscription.
Sourcepub fn next_unique() -> Self
pub fn next_unique() -> Self
Returns an id that no other live connection in this process shares.
Together with the subscription id this scopes a subscription, and servers of different transports can serve one shared subscription table, so the id has to be unique across every server in the process and not only within a single accept loop. Counting per server would give the first connection of each transport the same id, and an unsubscribe on one of them would then cancel a subscription of another.
A usize cannot wrap in practice on 64-bit targets, so ids are never reused and never reach
Self::IN_PROCESS.
Trait Implementations§
Source§impl Clone for ConnectionId
impl Clone for ConnectionId
impl Copy for ConnectionId
Source§impl Debug for ConnectionId
impl Debug for ConnectionId
Source§impl Default for ConnectionId
impl Default for ConnectionId
Source§impl<'de> Deserialize<'de> for ConnectionId
impl<'de> Deserialize<'de> for ConnectionId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ConnectionId
Source§impl From<usize> for ConnectionId
impl From<usize> for ConnectionId
Source§impl Hash for ConnectionId
impl Hash for ConnectionId
Source§impl PartialEq for ConnectionId
impl PartialEq for ConnectionId
Source§impl Serialize for ConnectionId
impl Serialize for ConnectionId
impl StructuralPartialEq for ConnectionId
Auto Trait Implementations§
impl Freeze for ConnectionId
impl RefUnwindSafe for ConnectionId
impl Send for ConnectionId
impl Sync for ConnectionId
impl Unpin for ConnectionId
impl UnsafeUnpin for ConnectionId
impl UnwindSafe for ConnectionId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes