pub struct NoteStore { /* private fields */ }Expand description
Review notes, kept in <git common dir>/declutter/notes.json until cleared or
posted. A store can be scoped to one review; it then reads and writes only that
review’s notes, and leaves the others alone.
Implementations§
Source§impl NoteStore
impl NoteStore
pub fn open(dir: &Path) -> NoteStore
pub fn at(path: PathBuf) -> NoteStore
pub fn in_memory() -> NoteStore
Sourcepub fn scoped(self, review: impl Into<String>) -> NoteStore
pub fn scoped(self, review: impl Into<String>) -> NoteStore
The same store, seeing only the notes of review.
pub fn notes(&self) -> Vec<&Note>
Sourcepub fn export_path(&self) -> Option<PathBuf>
pub fn export_path(&self) -> Option<PathBuf>
Where exported prompts are written, next to the notes themselves.
pub fn find(&self, path: &str, side: NoteSide, line: usize) -> Option<&Note>
Sourcepub fn set(&mut self, note: Note) -> Result<()>
pub fn set(&mut self, note: Note) -> Result<()>
Adds or replaces the note on the same line of this review; an empty text removes it.
Sourcepub fn clear(&mut self) -> Result<()>
pub fn clear(&mut self) -> Result<()>
Deletes this review’s notes (every note, when the store is not scoped).
Auto Trait Implementations§
impl Freeze for NoteStore
impl RefUnwindSafe for NoteStore
impl Send for NoteStore
impl Sync for NoteStore
impl Unpin for NoteStore
impl UnsafeUnpin for NoteStore
impl UnwindSafe for NoteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more