Add Tuple Deserializer Visitor constructor

This commit is contained in:
Erick Tryzelaar 2015-07-21 19:34:07 -07:00
parent 1751155a3a
commit b3cf9375d4

View File

@ -571,6 +571,15 @@ macro_rules! tuple_impls {
marker: PhantomData<($($name,)+)>, marker: PhantomData<($($name,)+)>,
} }
impl<
$($name: Deserialize,)+
> $visitor<$($name,)+> {
fn new() -> Self {
$visitor { marker: PhantomData }
}
}
impl< impl<
$($name: Deserialize,)+ $($name: Deserialize,)+
> Visitor for $visitor<$($name,)+> { > Visitor for $visitor<$($name,)+> {
@ -601,7 +610,7 @@ macro_rules! tuple_impls {
fn deserialize<D>(deserializer: &mut D) -> Result<($($name,)+), D::Error> fn deserialize<D>(deserializer: &mut D) -> Result<($($name,)+), D::Error>
where D: Deserializer, where D: Deserializer,
{ {
deserializer.visit_tuple($visitor { marker: PhantomData }) deserializer.visit_tuple($visitor::new())
} }
} }
)+ )+