pub struct LocalDocs { /* private fields */ }Expand description
The doc store of one project, at a directory the caller chose.
Implementations§
Source§impl LocalDocs
impl LocalDocs
pub fn at(dir: impl Into<PathBuf>) -> Self
pub fn dir(&self) -> &Path
Sourcepub fn entries(&self) -> Result<Vec<Entry>, LocalError>
pub fn entries(&self) -> Result<Vec<Entry>, LocalError>
Every entry, in journal order; empty when the store was never written.
§Errors
An unreadable or oversized journal, or a line that is not an entry.
Sourcepub fn space(&self) -> Result<DocSpace, LocalError>
pub fn space(&self) -> Result<DocSpace, LocalError>
Sourcepub fn pages(&self) -> Result<Vec<Page>, LocalError>
pub fn pages(&self) -> Result<Vec<Page>, LocalError>
The live pages as Page values, by slug: what a vault takes on
link (crate::write::create_page). Section bodies keep their
storage form (cloud: links name local page ids).
§Errors
As Self::entries.
Sourcepub fn commit<E: From<LocalError>>(
&self,
author: &Author,
at: &str,
action: &str,
plan: impl FnOnce(&DocSpace) -> Result<Vec<EventSpec>, E>,
) -> Result<Committed, E>
pub fn commit<E: From<LocalError>>( &self, author: &Author, at: &str, action: &str, plan: impl FnOnce(&DocSpace) -> Result<Vec<EventSpec>, E>, ) -> Result<Committed, E>
Runs plan against the current pages under the store’s lock and
appends its events as one revision by author at at.
§Errors
plan’s own error; a full journal or too many events; I/O.
Trait Implementations§
Auto Trait Implementations§
impl Forget for LocalDocs
impl Freeze for LocalDocs
impl Move for LocalDocs
impl RefUnwindSafe for LocalDocs
impl Send for LocalDocswhere
RawVecInner: Send,
impl Sync for LocalDocswhere
RawVecInner: Sync,
impl Unpin for LocalDocs
impl UnsafeUnpin for LocalDocs
impl UnwindSafe for LocalDocswhere
RawVecInner: UnwindSafe,
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