note_id: add hex helpers for root notes

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-01-22 13:12:03 -08:00
parent ed455f7ea4
commit d85b610cf4

View File

@@ -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())
}