pub struct Id { /* private fields */ }Expand description
Represents a complete Luhmann-style ID (e.g., “1”, “1a”, “1a2b”, “42c17z”)
Implementations§
Source§impl Id
impl Id
Sourcepub fn new(components: Vec<IdComponent>) -> IdResult<Self>
pub fn new(components: Vec<IdComponent>) -> IdResult<Self>
Create a new ID from components
Sourcepub fn from_number(n: u32) -> Self
pub fn from_number(n: u32) -> Self
Create ID from a single numeric component (e.g., “1”, “42”)
Sourcepub fn components(&self) -> &[IdComponent]
pub fn components(&self) -> &[IdComponent]
Get all components
Sourcepub fn parent(&self) -> IdResult<Option<Self>>
pub fn parent(&self) -> IdResult<Option<Self>>
Get the parent ID by removing the last component
Sourcepub fn next_sibling(&self) -> IdResult<Self>
pub fn next_sibling(&self) -> IdResult<Self>
Get the next sibling ID (increment last component)
Sourcepub fn first_child(&self) -> Self
pub fn first_child(&self) -> Self
Get the first child ID (append appropriate component type)
Sourcepub fn is_ancestor_of(&self, other: &Id) -> bool
pub fn is_ancestor_of(&self, other: &Id) -> bool
Check if this ID is an ancestor of another ID
Sourcepub fn is_descendant_of(&self, other: &Id) -> bool
pub fn is_descendant_of(&self, other: &Id) -> bool
Check if this ID is a descendant of another ID
Sourcepub fn is_sibling_of(&self, other: &Id) -> bool
pub fn is_sibling_of(&self, other: &Id) -> bool
Check if this ID is a sibling of another ID (same parent)
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
Source§impl Ord for Id
impl Ord for Id
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Id
impl PartialOrd 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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.