pub fn deserialize<'de, T, K, V, D>(deserializer: D) -> Result<T, D::Error>
    where
        D: Deserializer<'de>,
        T: FromIterator<(K, V)>,
        K: Deserialize<'de>,
        V: Deserialize<'de>,
    {
        struct SeqVisitor<T, K, V>(PhantomData<(T, K, V)>);

        impl<'de, T, K, V> Visitor<'de> for SeqVisitor<T, K, V>
        where
            T: FromIterator<(K, V)>,
            K: Deserialize<'de>,
            V: Deserialize<'de>,
        {
            type Value = T;

            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
                formatter.write_str("a list of key-value pairs")
            }

            fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
            where
                A: SeqAccess<'de>,
            {
                utils::SeqIter::new(seq).collect()
            }
        }

        deserializer.deserialize_seq(SeqVisitor(PhantomData))
    }
/// Deserialize a map from a list of tuples
Deserialize a map from a list of tuples
Deserialize a map from a list of tuples
pub fn deserialize<'de, T, K, V, D>(deserializer: D) -> Result<T, D::Error>
    where
        D: Deserializer<'de>,
        T: FromIterator<(K, V)>,
        K: Deserialize<'de>,
        V: Deserialize<'de>,
    {
        struct SeqVisitor<T, K, V>(PhantomData<(T, K, V)>);
        impl<'de, T, K, V> Visitor<'de> for SeqVisitor<T, K, V>
        where
            T: FromIterator<(K, V)>,
            K: Deserialize<'de>,
            V: Deserialize<'de>,
        {
            type Value = T;
            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
                formatter.write_str("a list of key-value pairs")
            }
            fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
            where
                A: SeqAccess<'de>,
            {
                utils::SeqIter::new(seq).collect()
            }
        }
        deserializer.deserialize_seq(SeqVisitor(PhantomData))
    }
pub fn deserialize < ' de , T , K , V , D > ( deserializer : D ) -> Result < T , D :: Error > where D : Deserializer < ' de > , T : FromIterator < ( K , V ) > , K : Deserialize < ' de > , V : Deserialize < ' de > , { struct SeqVisitor < T , K , V > ( PhantomData < ( T , K , V ) > ) ; impl < ' de , T , K , V > Visitor < ' de > for SeqVisitor < T , K , V > where T : FromIterator < ( K , V ) > , K : Deserialize < ' de > , V : Deserialize < ' de > , { type Value = T ; fn expecting ( & self , formatter : & mut fmt :: Formatter < ' _ > ) -> fmt :: Result { formatter . write_str ( " " ) } fn visit_seq < A > ( self , seq : A ) -> Result < Self :: Value , A :: Error > where A : SeqAccess < ' de > , { utils :: SeqIter :: new ( seq ) . collect ( ) } } deserializer . deserialize_seq ( SeqVisitor ( PhantomData ) ) }
Deserialize a map from a list of tuples
Deserialize a map from a list of tuples
deserializer
D
deserializer
D