pub struct Loader<K, V, F>{ /* private fields */ }Implementations§
Source§impl<K, V, F> Loader<K, V, F>
impl<K, V, F> Loader<K, V, F>
pub fn new(load_fn: F) -> Loader<K, V, F>
pub fn with_max_batch_size(self, max_batch_size: usize) -> Self
pub fn with_yield_count(self, yield_count: usize) -> Self
Sourcepub fn with_custom_wait_for_work(self, wait_for_work_fn: impl WaitForWorkFn)
pub fn with_custom_wait_for_work(self, wait_for_work_fn: impl WaitForWorkFn)
Replaces the yielding for work behavior with an arbitrary future. Rather than yielding
the runtime repeatedly this will generate and .await a future of your choice.
This is incompatible with Self::with_yield_count().
pub fn max_batch_size(&self) -> usize
pub async fn try_load(&self, key: K) -> Result<V, Error>
pub async fn load(&self, key: K) -> V
pub async fn load_many(&self, keys: Vec<K>) -> HashMap<K, V>
pub async fn try_load_many(&self, keys: Vec<K>) -> Result<HashMap<K, V>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<K, V, F> Freeze for Loader<K, V, F>
impl<K, V, F> !RefUnwindSafe for Loader<K, V, F>
impl<K, V, F> Send for Loader<K, V, F>
impl<K, V, F> Sync for Loader<K, V, F>
impl<K, V, F> Unpin for Loader<K, V, F>
impl<K, V, F> !UnwindSafe for Loader<K, V, F>
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