Merge pull request #223 from jwilm/hinting-for-struct-keys
feat(de): Support struct key hinting
This commit is contained in:
commit
b3212f4c2b
@ -403,6 +403,16 @@ pub trait Deserializer {
|
|||||||
self.visit_seq(visitor)
|
self.visit_seq(visitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This method hints that the `Deserialize` type is expecting some sort of struct key mapping.
|
||||||
|
/// This allows deserializers to choose between &str, usize, or &[u8] to properly deserialize a
|
||||||
|
/// struct key.
|
||||||
|
#[inline]
|
||||||
|
fn visit_struct_key<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>
|
||||||
|
where V: Visitor,
|
||||||
|
{
|
||||||
|
self.visit(visitor)
|
||||||
|
}
|
||||||
|
|
||||||
/// Specify a format string for the deserializer.
|
/// Specify a format string for the deserializer.
|
||||||
///
|
///
|
||||||
/// The deserializer format is used to determine which format
|
/// The deserializer format is used to determine which format
|
||||||
|
@ -917,7 +917,7 @@ fn deserialize_field_visitor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deserializer.visit(__FieldVisitor::<D>{ phantom: PhantomData })
|
deserializer.visit_struct_key(__FieldVisitor::<D>{ phantom: PhantomData })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user