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 add(&mut self, note: Note) -> Result<Added>
pub fn add(&mut self, note: Note) -> Result<Added>
Adds a note, putting its text under any note already on that line rather than replacing it. A note that gains text it didn’t have takes the new note’s draft state, so text nobody has read is never posted as read.
Sourcepub fn record_posted(&mut self, posted: &[(Note, Link)]) -> Result<()>
pub fn record_posted(&mut self, posted: &[(Note, Link)]) -> Result<()>
Logs these notes as posted, each with where it landed, and drops them from the store.
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
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> ⓘ
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> ⓘ
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