MappedDocuments

Struct MappedDocuments 

Source
pub struct MappedDocuments<D, V: View> {
    pub mappings: ViewMappings<V>,
    pub documents: BTreeMap<<V::Collection as Collection>::PrimaryKey, D>,
}
Expand description

A collection of mappings and the associated documents.

Fields§

§mappings: ViewMappings<V>

The collection of mappings.

§documents: BTreeMap<<V::Collection as Collection>::PrimaryKey, D>

All associated documents by ID.

Documents can appear in a mapping query multiple times. As a result, they are stored separately to avoid duplication.

Implementations§

Source§

impl<D, V: View> MappedDocuments<D, V>

Source

pub fn len(&self) -> usize

The number of mappings contained in this collection.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no mappings in this collection.

Source

pub fn get( &self, index: usize, ) -> Option<MappedDocument<'_, D, V::Key, V::Value>>

Returns the mapped document atindex, or None if index >= self.len().

Trait Implementations§

Source§

impl<D, V: View> Debug for MappedDocuments<D, V>
where V::Key: Debug, V::Value: Debug, D: Debug, <V::Collection as Collection>::PrimaryKey: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, D, V: View> IntoIterator for &'a MappedDocuments<D, V>

Source§

type IntoIter = MappedDocumentsIter<'a, D, V>

Which kind of iterator are we turning this into?
Source§

type Item = MappedDocument<'a, D, <V as View>::Key, <V as View>::Value>

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<D, V> Freeze for MappedDocuments<D, V>

§

impl<D, V> RefUnwindSafe for MappedDocuments<D, V>

§

impl<D, V> Send for MappedDocuments<D, V>
where D: Send,

§

impl<D, V> Sync for MappedDocuments<D, V>
where D: Sync,

§

impl<D, V> Unpin for MappedDocuments<D, V>
where <V as View>::Key: Unpin, <V as View>::Value: Unpin, <<V as View>::Collection as Collection>::PrimaryKey: Unpin,

§

impl<D, V> UnwindSafe for MappedDocuments<D, V>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.