pub fn serialize<'a, T, K, V, S>(map: T, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
        T: IntoIterator<Item = (&'a K, &'a V)>,
        T::IntoIter: ExactSizeIterator,
        K: Serialize + 'a,
        V: Serialize + 'a,
    {
        let mut iter = map.into_iter();
        let mut seq = serializer.serialize_seq(Some(iter.len()))?;
        iter.try_for_each(|item| {
            seq.serialize_element(&item)?;
            Ok(())
        })?;
        seq.end()
    }
/// Serialize the map as a list of tuples
Serialize the map as a list of tuples
Serialize the map as a list of tuples
pub fn serialize<'a, T, K, V, S>(map: T, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: Serializer,
        T: IntoIterator<Item = (&'a K, &'a V)>,
        T::IntoIter: ExactSizeIterator,
        K: Serialize + 'a,
        V: Serialize + 'a,
    {
        let mut iter = map.into_iter();
        let mut seq = serializer.serialize_seq(Some(iter.len()))?;
        iter.try_for_each(|item| {
            seq.serialize_element(&item)?;
            Ok(())
        })?;
        seq.end()
    }
pub fn serialize < ' a , T , K , V , S > ( map : T , serializer : S ) -> Result < S :: Ok , S :: Error > where S : Serializer , T : IntoIterator < Item = ( & ' a K , & ' a V ) > , T :: IntoIter : ExactSizeIterator , K : Serialize + ' a , V : Serialize + ' a , { let mut iter = map . into_iter ( ) ; let mut seq = serializer . serialize_seq ( Some ( iter . len ( ) ) ) ? ; iter . try_for_each ( | item | { seq . serialize_element ( & item ) ? ; Ok ( ( ) ) } ) ? ; seq . end ( ) }
Serialize the map as a list of tuples
Serialize the map as a list of tuples
map
T
serializer
S
map
T
serializer
S