pub struct MutableCollection<'a> { /* private fields */ }
Expand description

A reference to a modifiable set of objects matching a given query, as returned by Checkpoint::query().

All methods of Collection are available for MutableCollection.

Implementations§

source§

impl<'a> MutableCollection<'a>

source

pub fn delete(&self) -> Result<usize>

Delete all objects in the collection.

Returns the number of deleted objects.

source

pub fn set(&self, fields: Object) -> Result<usize>

Set the given fields on objects in the collection.

Returns the number of updated objects.

Methods from Deref<Target = Collection<'a>>§

source

pub fn len(&self) -> Result<usize>

Get the number of objects in the collection.

source

pub fn exists(&self) -> Result<bool>

Returns true if there are any objects in the collection.

source

pub fn iter(&self) -> Result<impl Iterator<Item = Object> + 'a>

Iterate over all objects in the collection.

This prefetches all objects in the collection so that errors can be reported early.

source

pub fn one(&self) -> Result<Object>

Get one and only one object from the collection.

Will error if more than one object is returned.

source

pub fn iter_as<T: ObjectShapePlain + 'a>( &self ) -> Result<impl Iterator<Item = T> + 'a>

Iterate over all objects in the collection, converting them to the given shape.

This prefetches all objects in the collection so that errors can be reported early.

source

pub fn one_as<T: ObjectShapePlain + 'a>(&self) -> Result<T>

Get one and only one object from the collection, converting it to the given shape.

Will error if more than one object is returned.

source

pub fn iter_converted<T: ObjectShape + 'a>( &self, store: &Store ) -> Result<impl Iterator<Item = T> + 'a>

Iterate over all objects in the collection, converting them to the given shape.

This prefetches all objects in the collection so that errors can be reported early.

source

pub fn one_converted<T: ObjectShape + 'a>(&self, store: &Store) -> Result<T>

Get one and only one object from the collection, converting it to the given shape.

Will error if more than one object is returned.

Trait Implementations§

source§

impl<'a> Deref for MutableCollection<'a>

§

type Target = Collection<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Collection<'a>

Dereferences the value.

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'a> Unpin for MutableCollection<'a>

§

impl<'a> !UnwindSafe for MutableCollection<'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.