pub struct NoteId(/* private fields */);Expand description
A lexicographically sortable note identifier (fixed-width base32, 26 chars).
The 128-bit value uses Lamport depth in the high 64 bits and a content hash in the low 64 bits. The ID is assigned once and never recomputed. Fixed-width encoding makes string order identical to numeric Lamport order.
Implementations§
Source§impl NoteId
impl NoteId
pub const ENCODED_LEN: usize = 26
Sourcepub fn allocate(previous_tip: Option<&Self>, content: &str) -> Self
pub fn allocate(previous_tip: Option<&Self>, content: &str) -> Self
Allocate the next ID after previous_tip for content.
Sourcepub fn tip<'a>(ids: impl IntoIterator<Item = &'a Self>) -> Option<Self>
pub fn tip<'a>(ids: impl IntoIterator<Item = &'a Self>) -> Option<Self>
Return the Lamport tip from an iterator of existing note IDs.
pub fn as_str(&self) -> &str
pub fn depth(&self) -> u64
pub fn hash(&self) -> u64
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NoteId
impl<'de> Deserialize<'de> for NoteId
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 NoteId
Source§impl Ord for NoteId
impl Ord for NoteId
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
Source§impl PartialOrd for NoteId
impl PartialOrd for NoteId
impl StructuralPartialEq for NoteId
Auto Trait Implementations§
impl Freeze for NoteId
impl RefUnwindSafe for NoteId
impl Send for NoteId
impl Sync for NoteId
impl Unpin for NoteId
impl UnsafeUnpin for NoteId
impl UnwindSafe for NoteId
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