From d85b610cf42fd6c7ea35618d60db6c86be885c7c Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 22 Jan 2025 13:12:03 -0800 Subject: [PATCH] note_id: add hex helpers for root notes Signed-off-by: William Casarin --- crates/notedeck/src/note.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/notedeck/src/note.rs b/crates/notedeck/src/note.rs index 4c351b1..e342186 100644 --- a/crates/notedeck/src/note.rs +++ b/crates/notedeck/src/note.rs @@ -34,6 +34,10 @@ impl RootNoteIdBuf { root_note_id_from_selected_id(ndb, note_cache, txn, id).map(|rnid| Self(*rnid.bytes())) } + pub fn hex(&self) -> String { + hex::encode(self.bytes()) + } + pub fn new_unsafe(id: [u8; 32]) -> Self { Self(id) } @@ -52,6 +56,10 @@ impl<'a> RootNoteId<'a> { self.0 } + pub fn hex(&self) -> String { + hex::encode(self.bytes()) + } + pub fn to_owned(&self) -> RootNoteIdBuf { RootNoteIdBuf::new_unsafe(*self.bytes()) }