pub fn read_map<T, K, V>(
items: &[T],
k: impl Fn(&T) -> &Option<K::Proto>,
v: impl Fn(&T) -> &Option<V::Proto>,
) -> Result<BTreeMap<K, V>>
Expand description
Parses a repeated proto struct into a map.
The method assumes that we have a BTreeMap<K, V>
field that we serialized
as Vec<T>
into protobuf, where T
consists of a K::Proto
and V::Proto
field. The k
and v
function are getters to project T
into the key and
value protobuf components, which are individually decoded into K
and V
.