Struct ConnectionId
pub struct ConnectionId(pub usize);server-core only.Expand description
Connection ID.
Tuple Fields§
§0: usizeImplementations§
§impl ConnectionId
impl ConnectionId
pub const IN_PROCESS: ConnectionId
pub const IN_PROCESS: ConnectionId
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.
pub fn next_unique() -> ConnectionId
pub fn next_unique() -> ConnectionId
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§
§impl Clone for ConnectionId
impl Clone for ConnectionId
§fn clone(&self) -> ConnectionId
fn clone(&self) -> ConnectionId
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConnectionId
§impl Debug for ConnectionId
impl Debug for ConnectionId
§impl Default for ConnectionId
impl Default for ConnectionId
§fn default() -> ConnectionId
fn default() -> ConnectionId
§impl<'de> Deserialize<'de> for ConnectionId
impl<'de> Deserialize<'de> for ConnectionId
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConnectionId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConnectionId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for ConnectionId
§impl From<usize> for ConnectionId
impl From<usize> for ConnectionId
§fn from(id: usize) -> ConnectionId
fn from(id: usize) -> ConnectionId
§impl Hash for ConnectionId
impl Hash for ConnectionId
§impl PartialEq for ConnectionId
impl PartialEq for ConnectionId
§impl Serialize for ConnectionId
impl Serialize for ConnectionId
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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