[][src]Struct async_graphql::dataloader::DataLoader

pub struct DataLoader<T> { /* fields omitted */ }
This is supported on crate feature dataloader only.

Data loader.

Reference: https://github.com/facebook/dataloader

Implementations

impl<T> DataLoader<T>[src]

pub fn new(loader: T) -> Self[src]

Create a DataLoader with the Loader trait.

pub fn delay(self, delay: Duration) -> Self[src]

Specify the delay time for loading data, the default is 1ms.

pub fn max_batch_size(self, max_batch_size: usize) -> Self[src]

pub fn Specify the max batch size for loading data, the default is 1000.

If the keys waiting to be loaded reach the threshold, they are loaded immediately.

pub async fn load_one<K>(&self, key: K) -> Result<Option<T::Value>, T::Error> where
    K: Send + Sync + Hash + Eq + Clone + 'static,
    T: Loader<K>, 
[src]

Use this DataLoader load a data.

pub async fn load_many<K>(
    &self,
    keys: impl Iterator<Item = K>
) -> Result<HashMap<K, T::Value>, T::Error> where
    K: Send + Sync + Hash + Eq + Clone + 'static,
    T: Loader<K>, 
[src]

Use this DataLoader to load some data.

Auto Trait Implementations

impl<T> !RefUnwindSafe for DataLoader<T>[src]

impl<T> Send for DataLoader<T> where
    T: Send
[src]

impl<T> Sync for DataLoader<T> where
    T: Sync
[src]

impl<T> Unpin for DataLoader<T> where
    T: Unpin
[src]

impl<T> !UnwindSafe for DataLoader<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,