Struct qualia::Store

source ·
pub struct Store { /* private fields */ }
Expand description

A set of objects stored on disk.

Implementations§

source§

impl Store

source

pub fn open(path: impl AsRef<Path>) -> Result<Store>

Open a store at the given path.

source

pub fn all(&self) -> Collection<'_>

Get a Collection of all objects.

source

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.

source

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.

source

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.

source

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.

source

pub fn last_checkpoint_id(&self) -> Result<CheckpointId>

Get the ID of the last checkpoint, if any.

source

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.