Type Alias RetrievedObjects
pub type RetrievedObjects<K, O> = IndexMap<K, Option<O>>;
Expand description
A data structure that holds a set of objects of a generic type O
, indexed by a key of type K
.
This type is typically returned by functions that operate on multiple objects, such as fetching multiple objects
from a server using FetchMany
or parsing a proof that contains multiple objects
using FromProof
.
Each key K
in the RetrievedObjects
corresponds to zero or one object of generic type O
:
- if an object is found for a given key, the value is
Some(object)
, - if no object is found for a given key, the value is
None
; this can be interpreted as a proof of absence.
This data structure preserves order of objects insertion. However, actual order of objects depends on the order of
objects returned by Dash Drive, which is not always guaranteed to be correct.
You can sort the objects by key if you need a specific order; see IndexMap::sort_keys
and similar methods.
RetrievedObjects
is a wrapper around the IndexMap
type.
§Generic Type Parameters
K
: The type of the keys in the map.O
: The type of the objects in the map.
Aliased Type§
struct RetrievedObjects<K, O> { /* private fields */ }