Skip to main content

missing_multimap_value

Function missing_multimap_value 

Source
pub fn missing_multimap_value<'de, T: Deserialize<'de>>() -> Option<T>
Expand description

Returns the value of a key that is missing in a multimap.

In a multimap (see ContainerShape::set_multimap) collections like Vec<T> and sets are empty if their key is missing. Other types have their initial_value (None for Option<T>). None means that the value is required. This is the counterpart of DeserializeDriver::multimap_value for a key that is not there.

use deser::de::missing_multimap_value;

assert_eq!(missing_multimap_value::<Vec<u16>>(), Some(vec![]));
assert_eq!(missing_multimap_value::<Option<u16>>(), Some(None));
assert_eq!(missing_multimap_value::<u16>(), None);