pub enum Id {
Zero,
One,
Branch(Box<Self>, Box<Self>),
}Expand description
An ITC identity tree, partitioning [0, 1) among participants.
Leaves are either 0 (not owned) or 1 (owned). Interior nodes
split the interval into left and right halves. Normalization collapses
degenerate branches: Branch(0, 0) → Zero, Branch(1, 1) → One.
Variants§
Zero
Leaf 0 — this portion of the interval is not owned.
One
Leaf 1 — this portion of the interval is owned.
Branch(Box<Self>, Box<Self>)
Branch splitting the interval into left and right halves.
Implementations§
Source§impl Id
impl Id
Sourcepub fn branch(left: Self, right: Self) -> Self
pub fn branch(left: Self, right: Self) -> Self
Create a branch, automatically normalizing degenerate cases.
Sourcepub fn is_one(&self) -> bool
pub fn is_one(&self) -> bool
Returns true if this identity owns the entire interval (is all ones).
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in the tree (leaves + branches).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnsafeUnpin for Id
impl UnwindSafe for Id
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.