pub fn deserialize<'de, D, T, V>(deserializer: D) -> Result<T, D::Error>
    where
        T: DuplicateInsertsLastWinsSet<V>,
        V: Deserialize<'de>,
        D: Deserializer<'de>,
    {
        struct SeqVisitor<T, V> {
            marker: PhantomData<T>,
            set_item_type: PhantomData<V>,
        }

        impl<'de, T, V> Visitor<'de> for SeqVisitor<T, V>
        where
            T: DuplicateInsertsLastWinsSet<V>,
            V: Deserialize<'de>,
        {
            type Value = T;

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

            #[inline]
            fn visit_seq<A>(self, mut access: A) -> Result<Self::Value, A::Error>
            where
                A: SeqAccess<'de>,
            {
                let mut values = Self::Value::new(access.size_hint());

                while let Some(value) = access.next_element()? {
                    values.replace(value);
                }

                Ok(values)
            }
        }

        let visitor = SeqVisitor {
            marker: PhantomData,
            set_item_type: PhantomData,
        };
        deserializer.deserialize_seq(visitor)
    }
/// Deserialize a set and keep the last of equal values
Deserialize a set and keep the last of equal values
Deserialize a set and keep the last of equal values
pub fn deserialize<'de, D, T, V>(deserializer: D) -> Result<T, D::Error>
    where
        T: DuplicateInsertsLastWinsSet<V>,
        V: Deserialize<'de>,
        D: Deserializer<'de>,
    {
        struct SeqVisitor<T, V> {
            marker: PhantomData<T>,
            set_item_type: PhantomData<V>,
        }
        impl<'de, T, V> Visitor<'de> for SeqVisitor<T, V>
        where
            T: DuplicateInsertsLastWinsSet<V>,
            V: Deserialize<'de>,
        {
            type Value = T;
            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
                formatter.write_str("a sequence")
            }
            #[inline]
            fn visit_seq<A>(self, mut access: A) -> Result<Self::Value, A::Error>
            where
                A: SeqAccess<'de>,
            {
                let mut values = Self::Value::new(access.size_hint());
                while let Some(value) = access.next_element()? {
                    values.replace(value);
                }
                Ok(values)
            }
        }
        let visitor = SeqVisitor {
            marker: PhantomData,
            set_item_type: PhantomData,
        };
        deserializer.deserialize_seq(visitor)
    }
pub fn deserialize < ' de , D , T , V > ( deserializer : D ) -> Result < T , D :: Error > where T : DuplicateInsertsLastWinsSet < V > , V : Deserialize < ' de > , D : Deserializer < ' de > , { struct SeqVisitor < T , V > { marker : PhantomData < T > , set_item_type : PhantomData < V > , } impl < ' de , T , V > Visitor < ' de > for SeqVisitor < T , V > where T : DuplicateInsertsLastWinsSet < V > , V : Deserialize < ' de > , { type Value = T ; fn expecting ( & self , formatter : & mut fmt :: Formatter < ' _ > ) -> fmt :: Result { formatter . write_str ( " " ) } # [ inline ] fn visit_seq < A > ( self , mut access : A ) -> Result < Self :: Value , A :: Error > where A : SeqAccess < ' de > , { let mut values = Self :: Value :: new ( access . size_hint ( ) ) ; while let Some ( value ) = access . next_element ( ) ? { values . replace ( value ) ; } Ok ( values ) } } let visitor = SeqVisitor { marker : PhantomData , set_item_type : PhantomData , } ; deserializer . deserialize_seq ( visitor ) }
Deserialize a set and keep the last of equal values
Deserialize a set and keep the last of equal values
deserializer
D
deserializer
D