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§
Sourcefn load(&self) -> Result<Document, StoreError>
fn load(&self) -> Result<Document, StoreError>
Sourcefn save(&mut self, document: &Document) -> Result<Saved, StoreError>
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§
Sourcefn roots(&self) -> Result<Roots, StoreError>
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".