From e99e6e30b730b01b6a7ba0db6e927a00f1e40bae Mon Sep 17 00:00:00 2001 From: William Casarin Date: Fri, 15 Dec 2023 08:13:06 -0800 Subject: [PATCH] doc: some initial note docs --- src/note.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/note.rs b/src/note.rs index 21672bc..8716a52 100644 --- a/src/note.rs +++ b/src/note.rs @@ -3,11 +3,15 @@ use crate::transaction::Transaction; #[derive(Debug)] pub enum Note<'a> { + /// A note in-memory outside of nostrdb Owned { ptr: *mut bindings::ndb_note, size: usize, }, + /// A note inside of nostrdb. Tied to the lifetime of a + /// [Transaction] to ensure no reading of data outside + /// of a transaction. Construct these with [Note::new_transactional]. Transactional { ptr: *mut bindings::ndb_note, size: usize, @@ -21,7 +25,8 @@ impl<'a> Note<'a> { Note::Owned { ptr, size } } - // Create a new note tied to a transaction + /// Constructs a `Note` in a transactional context. + /// Use [Note::new_transactional] to create a new transactional note. pub fn new_transactional( ptr: *mut bindings::ndb_note, size: usize,