pub struct ProjectNotes { /* private fields */ }Expand description
Every project’s memory, under one root directory.
Implementations§
Source§impl ProjectNotes
impl ProjectNotes
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Project memory under root (created on the first write).
Sourcepub fn dir(&self, project: &ProjectRef) -> Option<PathBuf>
pub fn dir(&self, project: &ProjectRef) -> Option<PathBuf>
project’s memory directory, when its id is valid.
Sourcepub fn file_name(kind: NoteKind, key: &str) -> Option<String>
pub fn file_name(kind: NoteKind, key: &str) -> Option<String>
The file name a note of kind and key is kept in, when the key
has a letter or digit.
Sourcepub fn write(
&self,
project: &ProjectRef,
note: &NoteWrite,
) -> Result<WriteOutcome, NoteError>
pub fn write( &self, project: &ProjectRef, note: &NoteWrite, ) -> Result<WriteOutcome, NoteError>
Writes (or replaces) one note.
Sourcepub fn delete(
&self,
project: &ProjectRef,
kind: Option<NoteKind>,
key: &str,
) -> Result<bool, NoteError>
pub fn delete( &self, project: &ProjectRef, kind: Option<NoteKind>, key: &str, ) -> Result<bool, NoteError>
Deletes the note of key, of kind or of any kind. Returns whether
a note was deleted.
Sourcepub fn read(
&self,
project: &ProjectRef,
kind: NoteKind,
key: &str,
) -> Option<String>
pub fn read( &self, project: &ProjectRef, kind: NoteKind, key: &str, ) -> Option<String>
The note of kind and key, as written on disk.
Sourcepub fn entries(&self, project: &ProjectRef) -> Vec<NoteEntry>
pub fn entries(&self, project: &ProjectRef) -> Vec<NoteEntry>
Every note of project, sorted by kind then name; empty when it has
none.
Sourcepub fn section(&self, project: &ProjectRef) -> Option<String>
pub fn section(&self, project: &ProjectRef) -> Option<String>
The section shown to the model on project’s turns, or None when
the project has no notes.
Sourcepub fn rebuild_index(&self, project: &ProjectRef) -> Result<(), NoteError>
pub fn rebuild_index(&self, project: &ProjectRef) -> Result<(), NoteError>
The index rebuilt from the notes on disk, after a write the caller
made outside ProjectNotes::write.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ProjectNotes
impl Freeze for ProjectNotes
impl Move for ProjectNotes
impl RefUnwindSafe for ProjectNotes
impl Send for ProjectNotes
impl Sync for ProjectNotes
impl Unpin for ProjectNotes
impl UnsafeUnpin for ProjectNotes
impl UnwindSafe for ProjectNotes
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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