pub struct NodeId(pub [u8; 20]);Tuple Fields§
§0: [u8; 20]Implementations§
Source§impl NodeId
impl NodeId
pub fn from_pubkey(pubkey: &VerifyingKey) -> Self
pub fn from_pubkey_bytes(pubkey: &[u8; 32]) -> Self
pub fn xor_distance(&self, other: &Self) -> [u8; 20]
Sourcepub fn distance_cmp(&self, target: &Self, other: &Self) -> Ordering
👎Deprecated: use NodeId::xor_distance_cmp(a, b, target) instead
pub fn distance_cmp(&self, target: &Self, other: &Self) -> Ordering
Deprecated: use NodeId::xor_distance_cmp for clarity.
Sourcepub fn xor_distance_cmp(a: &Self, b: &Self, target: &Self) -> Ordering
pub fn xor_distance_cmp(a: &Self, b: &Self, target: &Self) -> Ordering
Compare which of a or b is closer to target in XOR-distance.
Returns Ordering::Less when a is closer, Greater when b is,
and Equal when equidistant.
Trait Implementations§
impl Copy for NodeId
impl Eq for NodeId
impl StructuralPartialEq for NodeId
Auto Trait Implementations§
impl Freeze for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnsafeUnpin for NodeId
impl UnwindSafe for NodeId
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