pub trait RowSource where
    Self::Rows: Deref,
    for<'a> &'a <Self::Rows as Deref>::Target: IntoIterator<Item = &'a Self::Item>, 
{ type Item; type Rows; fn get(&self) -> Self::Rows; }
Expand description

Something which can provide a collection of objects on demand.

This trait generalises the idea of “something that can provide data to query”. It’s important to note that the data it contains is owned, and is therefore guaranteed to survive for as long as needed, in particular for the life of the query. For correctness, it is expected that the returned data is a snapshot that will not change.

The reason for this definition is to make it possible to return views of data without copying, where that makes sense. For example using Arc<Vec<T>> as a RowSource does not entail copying data. It’s possible to define mutable types that generate snapshots on demand which also implement RowSource, if you need your test data to evolve.

The main drawback of this definition is that supporting bare containers becomes very expensive. Vec<T> is defined to be a RowSource, but the entire Vec must be copied for every call to get.

Associated Types

The type of the objects this provides.

The type of the collection this provides.

Required methods

Return a new, owned collection of objects, which should now remain immutable.

Implementations on Foreign Types

Implementors