diff --git a/serde/src/de/content.rs b/serde/src/de/content.rs index 7b27fdd6..3ed6d3ce 100644 --- a/serde/src/de/content.rs +++ b/serde/src/de/content.rs @@ -570,7 +570,8 @@ impl Deserializer for ContentDeserializer } impl ContentDeserializer { - fn new(content: Content) -> Self { + /// private API, don't use + pub fn new(content: Content) -> Self { ContentDeserializer { content: content, err: PhantomData, @@ -655,7 +656,8 @@ impl<'a, E> Deserializer for ContentRefDeserializer<'a, E> } impl<'a, E> ContentRefDeserializer<'a, E> { - fn new(content: &'a Content) -> Self { + /// private API, don't use + pub fn new(content: &'a Content) -> Self { ContentRefDeserializer { content: content, err: PhantomData, diff --git a/serde/src/de/private.rs b/serde/src/de/private.rs index 750eecdc..566c4b11 100644 --- a/serde/src/de/private.rs +++ b/serde/src/de/private.rs @@ -5,6 +5,8 @@ use de::{Deserialize, Deserializer, Error, Visitor}; #[cfg(any(feature = "std", feature = "collections"))] pub use de::content::{ Content, + ContentRefDeserializer, + ContentDeserializer, TaggedContentVisitor, InternallyTaggedUnitVisitor, UntaggedUnitVisitor, diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs index b72d78ad..95abd5f0 100644 --- a/serde_derive/src/de.rs +++ b/serde_derive/src/de.rs @@ -704,7 +704,7 @@ fn deserialize_internally_tagged_enum( ty.clone(), variant, item_attrs, - quote!(_tagged.content), + quote!(_serde::de::private::ContentDeserializer::<__D::Error>::new(_tagged.content)), ); quote! { @@ -719,7 +719,7 @@ fn deserialize_internally_tagged_enum( let _tagged = try!(_serde::Deserializer::deserialize( deserializer, - _serde::de::private::TaggedContentVisitor::<__Field, __D::Error>::new(#tag))); + _serde::de::private::TaggedContentVisitor::<__Field>::new(#tag))); match _tagged.tag { #(#variant_arms)* @@ -743,7 +743,7 @@ fn deserialize_untagged_enum( ty.clone(), variant, item_attrs, - quote!(&_content), + quote!(_serde::de::private::ContentRefDeserializer::<__D::Error>::new(&_content)), ) }); @@ -756,7 +756,7 @@ fn deserialize_untagged_enum( let fallthrough_msg = format!("data did not match any variant of untagged enum {}", type_ident); quote!({ - let _content = try!(<_serde::de::private::Content<__D::Error> as _serde::Deserialize>::deserialize(deserializer)); + let _content = try!(<_serde::de::private::Content as _serde::Deserialize>::deserialize(deserializer)); #( if let _serde::export::Ok(ok) = #attempts {