pub struct HashMapToArray<K, V, N = DefaultLabels, U = RandomState, T = HashMap<K, V, U>>(/* private fields */);Available on crate feature 
std only.Expand description
A converter between a HashMap or HashMap-like type and a sequence of named key-value pairs
for human-readable encoding formats.
See top-level docs for example usage.
Implementations§
Source§impl<K, V, N, U, T> HashMapToArray<K, V, N, U, T>
 
impl<K, V, N, U, T> HashMapToArray<K, V, N, U, T>
Sourcepub fn serialize<'a, S>(map: &'a T, serializer: S) -> Result<S::Ok, S::Error>where
    K: 'a + Serialize,
    V: 'a + Serialize,
    N: KeyValueLabels,
    &'a T: IntoIterator<Item = (&'a K, &'a V)> + Serialize,
    S: Serializer,
 
pub fn serialize<'a, S>(map: &'a T, serializer: S) -> Result<S::Ok, S::Error>where
    K: 'a + Serialize,
    V: 'a + Serialize,
    N: KeyValueLabels,
    &'a T: IntoIterator<Item = (&'a K, &'a V)> + Serialize,
    S: Serializer,
Serializes the given map to an array of named key-values if the serializer is
human-readable.  Otherwise serializes the map as a map.
Sourcepub fn deserialize<'de, D>(deserializer: D) -> Result<T, D::Error>where
    K: Deserialize<'de> + Eq + Hash,
    V: Deserialize<'de>,
    N: KeyValueLabels,
    U: BuildHasher + Default,
    HashMap<K, V, U>: Into<T>,
    T: Deserialize<'de>,
    D: Deserializer<'de>,
 
pub fn deserialize<'de, D>(deserializer: D) -> Result<T, D::Error>where
    K: Deserialize<'de> + Eq + Hash,
    V: Deserialize<'de>,
    N: KeyValueLabels,
    U: BuildHasher + Default,
    HashMap<K, V, U>: Into<T>,
    T: Deserialize<'de>,
    D: Deserializer<'de>,
Deserializes from a serialized array of named key-values into a map if the serializer is human-readable. Otherwise deserializes from a serialized map.
Trait Implementations§
Source§impl<K, V, N, U, T> JsonSchema for HashMapToArray<K, V, N, U, T>
Available on crate feature json-schema only. 
impl<K, V, N, U, T> JsonSchema for HashMapToArray<K, V, N, U, T>
Available on crate feature 
json-schema only.Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
 
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
 
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the 
$ref keyword. Read moreAuto Trait Implementations§
impl<K, V, N, U, T> Freeze for HashMapToArray<K, V, N, U, T>
impl<K, V, N, U, T> RefUnwindSafe for HashMapToArray<K, V, N, U, T>
impl<K, V, N, U, T> Send for HashMapToArray<K, V, N, U, T>
impl<K, V, N, U, T> Sync for HashMapToArray<K, V, N, U, T>
impl<K, V, N, U, T> Unpin for HashMapToArray<K, V, N, U, T>
impl<K, V, N, U, T> UnwindSafe for HashMapToArray<K, V, N, U, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more