pub struct NetId64(pub u64);Expand description
Runtime-bound 64-bit identifier with [KIND:8][NODE:16][COUNTER:40] layout.
Copy + Clone + PartialEq + Eq + Hash + Ord — small value,
identity-by-bits, usable as a map key.
Tuple Fields§
§0: u64Implementations§
Source§impl NetId64
impl NetId64
Sourcepub const fn node(self) -> u16
pub const fn node(self) -> u16
The NODE part — which node, shard, partition, or runtime minted this id.
Sourcepub const fn make(kind: u8, node: u16, counter: u64) -> NetId64
pub const fn make(kind: u8, node: u16, counter: u64) -> NetId64
Build an id from the three fields. The counter is truncated to 40 bits.
Sourcepub const fn to_be_bytes(self) -> [u8; 8]
pub const fn to_be_bytes(self) -> [u8; 8]
Big-endian wire bytes.
Sourcepub const fn from_be_bytes(bytes: [u8; 8]) -> NetId64
pub const fn from_be_bytes(bytes: [u8; 8]) -> NetId64
Reconstruct from big-endian wire bytes.
Trait Implementations§
Source§impl Ord for NetId64
impl Ord for NetId64
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for NetId64
impl PartialOrd for NetId64
impl Copy for NetId64
impl Eq for NetId64
impl StructuralPartialEq for NetId64
Auto Trait Implementations§
impl Freeze for NetId64
impl RefUnwindSafe for NetId64
impl Send for NetId64
impl Sync for NetId64
impl Unpin for NetId64
impl UnsafeUnpin for NetId64
impl UnwindSafe for NetId64
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
Mutably borrows from an owned value. Read more