pub struct DataLoader<E>{ /* private fields */ }
Expand description
A dataloader used to batch requests to a DataLoaderFetcher
Implementations§
Source§impl<E> DataLoader<E>
impl<E> DataLoader<E>
Sourcepub fn new(
executor: E,
batch_size: usize,
concurrency: usize,
delay: Duration,
) -> Self
pub fn new( executor: E, batch_size: usize, concurrency: usize, delay: Duration, ) -> Self
Create a new dataloader
Sourcepub const fn builder() -> DataLoaderBuilder<E>
pub const fn builder() -> DataLoaderBuilder<E>
Create a builder for a DataLoader
Sourcepub async fn load(&self, items: E::Key) -> Result<Option<E::Value>, ()>
pub async fn load(&self, items: E::Key) -> Result<Option<E::Value>, ()>
Load a single key
Can return an error if the underlying DataLoaderFetcher
returns an
error
Returns None
if the key is not found
Auto Trait Implementations§
impl<E> Freeze for DataLoader<E>
impl<E> !RefUnwindSafe for DataLoader<E>
impl<E> Send for DataLoader<E>
impl<E> Sync for DataLoader<E>
impl<E> Unpin for DataLoader<E>
impl<E> !UnwindSafe for DataLoader<E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more