pub struct NodeId(pub u64);Expand description
A 64-bit Node ID (Core §2.5.5).
The value space is carved into ranges with different meanings, which NodeId::kind
reports. Not every 64-bit value is a legal operational Node ID.
Tuple Fields§
§0: u64Implementations§
Source§impl NodeId
impl NodeId
Sourcepub const UNSPECIFIED: Self
pub const UNSPECIFIED: Self
The Unspecified Node ID (§2.5.5.6).
Sourcepub const OPERATIONAL_MIN: u64 = 0x0000_0000_0000_0001
pub const OPERATIONAL_MIN: u64 = 0x0000_0000_0000_0001
The first operational Node ID.
Sourcepub const OPERATIONAL_MAX: u64 = 0xFFFF_FFEF_FFFF_FFFF
pub const OPERATIONAL_MAX: u64 = 0xFFFF_FFEF_FFFF_FFFF
The last operational Node ID.
Sourcepub const fn kind(self) -> NodeIdKind
pub const fn kind(self) -> NodeIdKind
Which range this value falls in.
Sourcepub const fn is_operational(self) -> bool
pub const fn is_operational(self) -> bool
Whether this is a usable operational Node ID.
Sourcepub const fn ephemeral(randomness: u64) -> Self
pub const fn ephemeral(randomness: u64) -> Self
An Ephemeral Initiator Node ID for an Unsecured Session Context (§4.13.2.1).
Initiators SHALL select a new random ephemeral node ID for each unsecured session, and SHALL select an ID that does not conflict with any ephemeral node IDs for any other ongoing unsecured sessions opened by the initiator.
The value is drawn from the caller’s Rng and folded into the
Operational Node ID range, which is where §4.13.2.1 says it has to come from. Folding
rather than rejecting is deliberate: a constructor that could fail would make the caller
choose what to do about randomness that fell outside a range, and the only correct answer
is to draw again — which this does arithmetically and without a loop.
Sourcepub const fn group(self) -> Option<GroupId>
pub const fn group(self) -> Option<GroupId>
The group this Node ID names, if it is a Group Node ID.
Sourcepub const fn from_group(group: GroupId) -> Self
pub const fn from_group(group: GroupId) -> Self
The Group Node ID for a group (§2.5.5.2).