pub struct NodeLabel {
pub label_val: [u8; 32],
pub label_len: u32,
}
Expand description
Represents the label of a AKD node
Fields§
§label_val: [u8; 32]
Stores a binary string as a 32-byte array of u8
s
label_len: u32
len keeps track of how long the binary string is in bits
Implementations§
source§impl NodeLabel
impl NodeLabel
sourcepub fn value<TC>(&self) -> Vec<u8, Global> ⓘwhere
TC: Configuration,
pub fn value<TC>(&self) -> Vec<u8, Global> ⓘwhere TC: Configuration,
Returns the value of the NodeLabel
sourcepub fn is_prefix_of(&self, other: &NodeLabel) -> bool
pub fn is_prefix_of(&self, other: &NodeLabel) -> bool
Outputs whether or not self is a prefix of the other NodeLabel
sourcepub fn get_longest_common_prefix<TC>(&self, other: NodeLabel) -> NodeLabelwhere
TC: Configuration,
pub fn get_longest_common_prefix<TC>(&self, other: NodeLabel) -> NodeLabelwhere TC: Configuration,
Takes as input a pointer to the caller and another NodeLabel, returns a NodeLabel that is the longest common prefix of the two.
sourcepub fn get_prefix(&self, len: u32) -> NodeLabel
pub fn get_prefix(&self, len: u32) -> NodeLabel
Returns the prefix of a specified length, and the entire value on an out of range length
sourcepub fn new(val: [u8; 32], len: u32) -> NodeLabel
pub fn new(val: [u8; 32], len: u32) -> NodeLabel
Creates a new NodeLabel with the given value and len (in bits).
sourcepub fn get_prefix_ordering(&self, other: NodeLabel) -> PrefixOrdering
pub fn get_prefix_ordering(&self, other: NodeLabel) -> PrefixOrdering
Gets the prefix ordering of other with respect to self, if self is a prefix of other. If self is not a prefix of other, then this returns PrefixOrdering::Invalid.
Trait Implementations§
source§impl Ord for NodeLabel
impl Ord for NodeLabel
source§impl PartialEq<NodeLabel> for NodeLabel
impl PartialEq<NodeLabel> for NodeLabel
source§impl PartialOrd<NodeLabel> for NodeLabel
impl PartialOrd<NodeLabel> for NodeLabel
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for NodeLabel
impl Eq for NodeLabel
impl StructuralEq for NodeLabel
impl StructuralPartialEq for NodeLabel
Auto Trait Implementations§
impl RefUnwindSafe for NodeLabel
impl Send for NodeLabel
impl Sync for NodeLabel
impl Unpin for NodeLabel
impl UnwindSafe for NodeLabel
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more