mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-19 01:24:21 +01:00
note_id: add hex helpers for root notes
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -34,6 +34,10 @@ impl RootNoteIdBuf {
|
|||||||
root_note_id_from_selected_id(ndb, note_cache, txn, id).map(|rnid| Self(*rnid.bytes()))
|
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 {
|
pub fn new_unsafe(id: [u8; 32]) -> Self {
|
||||||
Self(id)
|
Self(id)
|
||||||
}
|
}
|
||||||
@@ -52,6 +56,10 @@ impl<'a> RootNoteId<'a> {
|
|||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn hex(&self) -> String {
|
||||||
|
hex::encode(self.bytes())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn to_owned(&self) -> RootNoteIdBuf {
|
pub fn to_owned(&self) -> RootNoteIdBuf {
|
||||||
RootNoteIdBuf::new_unsafe(*self.bytes())
|
RootNoteIdBuf::new_unsafe(*self.bytes())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user