pub struct FileStore { /* private fields */ }Expand description
Filesystem operations on the vault.
Implementations§
Source§impl FileStore
impl FileStore
pub fn new(paths: Paths) -> Self
pub fn paths(&self) -> &Paths
Sourcepub fn serialize(memo: &Memo) -> Result<String>
pub fn serialize(memo: &Memo) -> Result<String>
Serialize a memo to its on-disk representation (frontmatter + body).
Sourcepub fn parse(content: &str) -> Result<ParsedFile>
pub fn parse(content: &str) -> Result<ParsedFile>
Parse raw file text. Never panics on malformed input.
Sourcepub fn read(&self, path: &Path) -> Result<ParsedFile>
pub fn read(&self, path: &Path) -> Result<ParsedFile>
Read and parse a file at an explicit path, attaching the path to any frontmatter error for diagnostics.
Sourcepub fn read_memo(&self, path: &Path) -> Result<Option<Memo>>
pub fn read_memo(&self, path: &Path) -> Result<Option<Memo>>
Parse into a complete Memo, recomputing the content hash from the
body. Returns None for body-only files (no identity to attach).
Sourcepub fn write(&self, memo: &Memo) -> Result<PathBuf>
pub fn write(&self, memo: &Memo) -> Result<PathBuf>
Atomically write a memo to its sharded path (or trash path when
deleted_at is set). Returns the path written.
Sourcepub fn move_to_trash(&self, memo: &Memo) -> Result<PathBuf>
pub fn move_to_trash(&self, memo: &Memo) -> Result<PathBuf>
Move a memo’s file from the live tree into the trash. Idempotent if the file is already trashed. Returns the trash path.
Sourcepub fn restore_from_trash(&self, memo: &Memo) -> Result<PathBuf>
pub fn restore_from_trash(&self, memo: &Memo) -> Result<PathBuf>
Restore a memo from the trash back to its live path.
Sourcepub fn purge(&self, id: MemoId) -> Result<bool>
pub fn purge(&self, id: MemoId) -> Result<bool>
Hard-delete a trashed memo file. Returns true if a file was removed.
Sourcepub fn list_memo_files(&self) -> Vec<PathBuf>
pub fn list_memo_files(&self) -> Vec<PathBuf>
Walk the live memos tree, yielding every .md file.
Sourcepub fn list_trash_files(&self) -> Vec<PathBuf>
pub fn list_trash_files(&self) -> Vec<PathBuf>
Walk the trash directory.
Auto Trait Implementations§
impl Freeze for FileStore
impl RefUnwindSafe for FileStore
impl Send for FileStore
impl Sync for FileStore
impl Unpin for FileStore
impl UnsafeUnpin for FileStore
impl UnwindSafe for FileStore
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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> ⓘ
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