pub trait NodeIdType: Clone {
Show 13 methods
// Required methods
fn random() -> u32;
fn segment(&self) -> NodeSegment;
fn distance(&self, other: &u32) -> u32;
fn distance_bits(&self, other: &u32) -> u8;
fn bucket_index(&self) -> u8;
fn build(geo1: u8, geo2: u8, group: u8, index: u8) -> Self;
fn build2(zone_id: u16, group: u8, index: u8) -> Self;
fn layer(&self, index: u8) -> u8;
fn geo1(&self) -> u8;
fn geo2(&self) -> u8;
fn group(&self) -> u8;
fn index(&self) -> u8;
fn eq_util_layer(&self, other: &Self) -> u8;
}Required Methods§
Sourcefn segment(&self) -> NodeSegment
fn segment(&self) -> NodeSegment
Returns the segment of the node ID.
Sourcefn distance_bits(&self, other: &u32) -> u8
fn distance_bits(&self, other: &u32) -> u8
Sourcefn bucket_index(&self) -> u8
fn bucket_index(&self) -> u8
Returns the index of the bucket that this node ID belongs to.
Sourcefn build(geo1: u8, geo2: u8, group: u8, index: u8) -> Self
fn build(geo1: u8, geo2: u8, group: u8, index: u8) -> Self
Builds a new NodeId with the given geographic location, group, and index.
§Arguments
geo1- The first geographic location byte.geo2- The second geographic location byte.group- The group byte.index- The index byte.
Sourcefn build2(zone_id: u16, group: u8, index: u8) -> Self
fn build2(zone_id: u16, group: u8, index: u8) -> Self
Builds a NodeId from a zone ID, group, and index.
Sourcefn layer(&self, index: u8) -> u8
fn layer(&self, index: u8) -> u8
Returns the value of the layer of the node at the given index.
Sourcefn eq_util_layer(&self, other: &Self) -> u8
fn eq_util_layer(&self, other: &Self) -> u8
Returns the number of layers that the two NodeIds are equal up to.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.