IntoDeserializer for HashSet and HashMap with non-default hasher

This commit is contained in:
David Tolnay 2017-10-20 21:36:40 -07:00
parent 9be3d32016
commit 30606a43aa
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -754,12 +754,13 @@ where
}
#[cfg(feature = "std")]
impl<'de, T, E> IntoDeserializer<'de, E> for HashSet<T>
impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet<T, S>
where
T: IntoDeserializer<'de, E> + Eq + Hash,
S: BuildHasher,
E: de::Error,
{
type Deserializer = SeqDeserializer<<HashSet<T> as IntoIterator>::IntoIter, E>;
type Deserializer = SeqDeserializer<<HashSet<T, S> as IntoIterator>::IntoIter, E>;
fn into_deserializer(self) -> Self::Deserializer {
SeqDeserializer::new(self.into_iter())
@ -1160,13 +1161,14 @@ where
}
#[cfg(feature = "std")]
impl<'de, K, V, E> IntoDeserializer<'de, E> for HashMap<K, V>
impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap<K, V, S>
where
K: IntoDeserializer<'de, E> + Eq + Hash,
V: IntoDeserializer<'de, E>,
S: BuildHasher,
E: de::Error,
{
type Deserializer = MapDeserializer<'de, <HashMap<K, V> as IntoIterator>::IntoIter, E>;
type Deserializer = MapDeserializer<'de, <HashMap<K, V, S> as IntoIterator>::IntoIter, E>;
fn into_deserializer(self) -> Self::Deserializer {
MapDeserializer::new(self.into_iter())