[−][src]Struct batchloader::KeySet
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]
self,
get_value: impl FnMut(&Key) -> Value
) -> ValueSet<Value>
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]
self,
get_value: impl FnMut(&Key) -> Result<Value, Error>
) -> Result<ValueSet<Value>, Error>
Fallible version of into_values. Same as into_values, but will return
an error the first time get_value
returns an error.
Trait Implementations
Auto Trait Implementations
impl<Key> RefUnwindSafe for KeySet<Key> where
Key: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key> Send for KeySet<Key> where
Key: Send,
Key: Send,
impl<Key> Sync for KeySet<Key> where
Key: Sync,
Key: Sync,
impl<Key> Unpin for KeySet<Key> where
Key: Unpin,
Key: Unpin,
impl<Key> UnwindSafe for KeySet<Key> where
Key: UnwindSafe,
Key: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,