pub trait InternalLoader<M> {
type Item;
type Query;
type Error: Debug + 'static;
const CHUNK_SIZE: Option<usize> = None;
// Required method
fn load_items_inner(
&self,
range: Range<usize>,
query: &Self::Query,
) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>>;
// Provided methods
fn load_items(
&self,
range: Range<usize>,
query: &Self::Query,
) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>> { ... }
fn item_count(
&self,
_query: &Self::Query,
) -> impl Future<Output = Result<Option<usize>, Self::Error>> { ... }
}Expand description
This is the trait for the actually used internal loaders. This trait is automatically implemented for all the user facing loader traits.
Provided Associated Constants§
Sourceconst CHUNK_SIZE: Option<usize> = None
const CHUNK_SIZE: Option<usize> = None
If this Some(…) then the data will be loaded in chunks of this size. This is useful for paginated data sources.
Required Associated Types§
Required Methods§
Sourcefn load_items_inner(
&self,
range: Range<usize>,
query: &Self::Query,
) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>>
fn load_items_inner( &self, range: Range<usize>, query: &Self::Query, ) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>>
Don’t call this directly. Call load_items instead.
Loads the items respecting the given range and query.
This does not respect CHUNK_SIZE.
Provided Methods§
Sourcefn load_items(
&self,
range: Range<usize>,
query: &Self::Query,
) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>>
fn load_items( &self, range: Range<usize>, query: &Self::Query, ) -> impl Future<Output = Result<LoadedItems<Self::Item>, Self::Error>>
Loads the items respecting the given range and query together with CHUNK_SIZE.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.