pub struct Store { /* private fields */ }
Expand description
A set of objects stored on disk.
Implementations§
source§impl Store
impl Store
sourcepub fn all(&self) -> Collection<'_>
pub fn all(&self) -> Collection<'_>
Get a Collection
of all objects.
sourcepub fn query(&self, query: impl Into<QueryNode>) -> Collection<'_>
pub fn query(&self, query: impl Into<QueryNode>) -> Collection<'_>
Get a Collection
of the objects matching the given query.
This can take either a QueryNode
or QueryBuilder
; you almost certainly want to use
the latter.
sourcepub fn cached_map<F: FnMut(Object, &Store) -> Result<O>, O>(
&self,
query: impl Into<QueryNode>,
f: F
) -> Result<CachedMapping<F, O>>
pub fn cached_map<F: FnMut(Object, &Store) -> Result<O>, O>( &self, query: impl Into<QueryNode>, f: F ) -> Result<CachedMapping<F, O>>
Get a CachedMapping
of the objects matching the given query.
Objects will be fetched ahead of time.
sourcepub fn checkpoint(&mut self) -> Result<Checkpoint<'_>>
pub fn checkpoint(&mut self) -> Result<Checkpoint<'_>>
Start a Checkpoint
on the store. All modifications must be done through a checkpoint.
This method takes a mutable reference to ensure that only one checkpoint can be active at a given time.
sourcepub fn undo(&mut self) -> Result<Option<String>>
pub fn undo(&mut self) -> Result<Option<String>>
Undo all changes in the last checkpoint.
Returns the description of the undone checkpoint, if any. If no checkpoints exists, returns
None
.
sourcepub fn last_checkpoint_id(&self) -> Result<CheckpointId>
pub fn last_checkpoint_id(&self) -> Result<CheckpointId>
Get the ID of the last checkpoint, if any.
sourcepub fn modified_since(&self, a: CheckpointId) -> Result<bool>
pub fn modified_since(&self, a: CheckpointId) -> Result<bool>
Check if the store has been changed since the given checkpoint.
Auto Trait Implementations§
impl !RefUnwindSafe for Store
impl Send for Store
impl !Sync for Store
impl Unpin for Store
impl !UnwindSafe for Store
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