[][src]Struct qualia::Collection

pub struct Collection<'a> { /* fields omitted */ }

A reference to the set of objects matching a given query, as returned by Store::all() or Store::query().

All actions on a collection are lazy; no queries are run or objects fetched until a method is called. The collection also doesn't hold on to the objects; if any of them are deleted or modified, future calls will return the new state.

A collection may be used multiple times. For instance, it's valid to call .len() and .iter() on the same Collection object.

Implementations

impl<'a> Collection<'a>[src]

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

Get the number of objects in the collection.

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

Returns true if there are any objects in the collection.

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

Iterate over all objects in the collection.

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

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

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.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Collection<'a>[src]

impl<'a> !Send for Collection<'a>[src]

impl<'a> !Sync for Collection<'a>[src]

impl<'a> Unpin for Collection<'a>[src]

impl<'a> !UnwindSafe for Collection<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.