[][src]Struct batchloader::KeySet

pub struct KeySet<Key: Eq + Hash> { /* fields omitted */ }

A set of keys passed into a batch loader function. Use the keys method to get the set of keys, all of which will be unique, so that you can execute your request. Then, use the into_key_values function to transform your response data into a ValueSet, which is handed back to the batch loader.

Methods

impl<Key: Eq + Hash> KeySet<Key>[src]

pub fn is_empty(&self) -> bool[src]

Check if there are any keys in this keyset

pub fn len(&self) -> usize[src]

Get the number of unique keys in this keyset.

pub fn keys(&self) -> impl Iterator<Item = &Key> + Clone[src]

Get an iterator over all the keys in this keyset. These are guaranteed to be:

  • Unique
  • Between 1 and the configured max_keys of the related BatchRules
  • In an arbitrary order

pub fn into_values<Value>(
    self,
    get_value: impl FnMut(&Key) -> Value
) -> ValueSet<Value>
[src]

After you've completed your request, use this method to pair each value in your result with its key. This is the only way to create a ValueSet, which is then returned from your batch function.

pub fn try_into_values<Value, Error>(
    self,
    get_value: impl FnMut(&Key) -> Result<Value, Error>
) -> Result<ValueSet<Value>, Error>
[src]

Fallible version of into_values. Same as into_values, but will return an error the first time get_value returns an error.

Trait Implementations

impl<Key: Debug + Eq + Hash> Debug for KeySet<Key>[src]

Auto Trait Implementations

impl<Key> RefUnwindSafe for KeySet<Key> where
    Key: RefUnwindSafe

impl<Key> Send for KeySet<Key> where
    Key: Send

impl<Key> Sync for KeySet<Key> where
    Key: Sync

impl<Key> Unpin for KeySet<Key> where
    Key: Unpin

impl<Key> UnwindSafe for KeySet<Key> where
    Key: UnwindSafe

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, U> Into<U> for T where
    U: From<T>, 
[src]

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.