pub trait MemoryLoader {
type Item;
type Query;
// Required methods
fn load_items(
&self,
range: Range<usize>,
query: &Self::Query,
) -> Vec<Self::Item>;
fn item_count(&self, query: &Self::Query) -> usize;
}Expand description
Loader trait for loading items on-demand from an in-memory data source.
In this case we don’t need async methods and everything is simple and synchronous.
Required Associated Types§
Required Methods§
Sourcefn load_items(
&self,
range: Range<usize>,
query: &Self::Query,
) -> Vec<Self::Item>
fn load_items( &self, range: Range<usize>, query: &Self::Query, ) -> Vec<Self::Item>
Loads items from the given range, respecting the query.
Sourcefn item_count(&self, query: &Self::Query) -> usize
fn item_count(&self, query: &Self::Query) -> usize
The total number of items of this data source with respect to the query.