Struct qualia::Checkpoint

source ·
pub struct Checkpoint<'a> { /* private fields */ }
Expand description

A set of not-yet-committed changes to a Store, as created by Store::checkpoint().

Implementations§

source§

impl<'a> Checkpoint<'a>

source

pub fn commit(self, description: impl AsRef<str>) -> Result<()>

Commit this transaction with the given description.

source

pub fn add(&self, object: Object) -> Result<i64>

Add an object to the store.

Returns the ID of the newly created object.

source

pub fn add_with_id<O>(&self, object: &mut O) -> Result<()>where O: Clone + ObjectShapeWithId + Into<Object>,

Add an object to the store.

Stores the ID inside the created object.

source

pub fn query(&self, query: impl Into<QueryNode>) -> MutableCollection<'_>

Get a MutableCollection of the objects matching the given query.

This can take either a QueryNode or QueryBuilder; you almost certainly want to use the latter.

Methods from Deref<Target = Store>§

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 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.

Trait Implementations§

source§

impl<'a> Deref for Checkpoint<'a>

§

type Target = Store

The resulting type after dereferencing.
source§

fn deref(&self) -> &Store

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Checkpoint<'a>

§

impl<'a> !Send for Checkpoint<'a>

§

impl<'a> !Sync for Checkpoint<'a>

§

impl<'a> Unpin for Checkpoint<'a>

§

impl<'a> !UnwindSafe for Checkpoint<'a>

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.