Skip to main content

DocumentStore

Trait DocumentStore 

Source
pub trait DocumentStore {
    // Required methods
    fn load(&self) -> Result<Document, StoreError>;
    fn save(&mut self, document: &Document) -> Result<Saved, StoreError>;

    // Provided method
    fn roots(&self) -> Result<Roots, StoreError> { ... }
}
Expand description

Where a document is held between commands.

Required Methods§

Source

fn load(&self) -> Result<Document, StoreError>

The document the store holds.

§Errors

The store holds no document, or its document cannot be read.

Source

fn save(&mut self, document: &Document) -> Result<Saved, StoreError>

Replaces the document the store holds, and reports the files of the document’s spec/ tree that the save wrote and removed.

§Errors

The document cannot be saved; a file store then leaves every file as it was or finishes the save the next time it is opened.

Provided Methods§

Source

fn roots(&self) -> Result<Roots, StoreError>

The roots of the document the store holds.

§Errors

As DocumentStore::load, or the document does not index.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§