Skip to content

Commit

Permalink
doc: some initial note docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jb55 committed Dec 15, 2023
1 parent 5145c2d commit e99e6e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit e99e6e3

Please sign in to comment.