Make serializer/deserializer internals doc(hidden)
This commit is contained in:
parent
d6de911855
commit
5f3fd9994e
@ -419,6 +419,7 @@ fn deserialize_unit_struct(params: &Parameters, cattrs: &attr::Container) -> Fra
|
|||||||
let expecting = cattrs.expecting().unwrap_or(&expecting);
|
let expecting = cattrs.expecting().unwrap_or(&expecting);
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor;
|
struct __Visitor;
|
||||||
|
|
||||||
impl<'de> _serde::de::Visitor<'de> for __Visitor {
|
impl<'de> _serde::de::Visitor<'de> for __Visitor {
|
||||||
@ -515,6 +516,7 @@ fn deserialize_tuple(
|
|||||||
};
|
};
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #de_impl_generics #where_clause {
|
struct __Visitor #de_impl_generics #where_clause {
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -605,6 +607,7 @@ fn deserialize_tuple_in_place(
|
|||||||
let place_life = place_lifetime();
|
let place_life = place_lifetime();
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #in_place_impl_generics #where_clause {
|
struct __Visitor #in_place_impl_generics #where_clause {
|
||||||
place: &#place_life mut #this_type #ty_generics,
|
place: &#place_life mut #this_type #ty_generics,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -1020,6 +1023,7 @@ fn deserialize_struct(
|
|||||||
quote_block! {
|
quote_block! {
|
||||||
#field_visitor
|
#field_visitor
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #de_impl_generics #where_clause {
|
struct __Visitor #de_impl_generics #where_clause {
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -1132,6 +1136,7 @@ fn deserialize_struct_in_place(
|
|||||||
Some(quote_block! {
|
Some(quote_block! {
|
||||||
#field_visitor
|
#field_visitor
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #in_place_impl_generics #where_clause {
|
struct __Visitor #in_place_impl_generics #where_clause {
|
||||||
place: &#place_life mut #this_type #ty_generics,
|
place: &#place_life mut #this_type #ty_generics,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -1203,6 +1208,7 @@ fn prepare_enum_variant_enum(
|
|||||||
let variants_stmt = {
|
let variants_stmt = {
|
||||||
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
|
let variant_names = variant_names_idents.iter().map(|(name, _, _)| name);
|
||||||
quote! {
|
quote! {
|
||||||
|
#[doc(hidden)]
|
||||||
const VARIANTS: &'static [&'static str] = &[ #(#variant_names),* ];
|
const VARIANTS: &'static [&'static str] = &[ #(#variant_names),* ];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1275,6 +1281,7 @@ fn deserialize_externally_tagged_enum(
|
|||||||
quote_block! {
|
quote_block! {
|
||||||
#variant_visitor
|
#variant_visitor
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #de_impl_generics #where_clause {
|
struct __Visitor #de_impl_generics #where_clause {
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -1522,6 +1529,7 @@ fn deserialize_adjacently_tagged_enum(
|
|||||||
|
|
||||||
#variants_stmt
|
#variants_stmt
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Seed #de_impl_generics #where_clause {
|
struct __Seed #de_impl_generics #where_clause {
|
||||||
field: __Field,
|
field: __Field,
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
@ -1541,6 +1549,7 @@ fn deserialize_adjacently_tagged_enum(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __Visitor #de_impl_generics #where_clause {
|
struct __Visitor #de_impl_generics #where_clause {
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -1643,6 +1652,7 @@ fn deserialize_adjacently_tagged_enum(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
const FIELDS: &'static [&'static str] = &[#tag, #content];
|
const FIELDS: &'static [&'static str] = &[#tag, #content];
|
||||||
_serde::Deserializer::deserialize_struct(
|
_serde::Deserializer::deserialize_struct(
|
||||||
__deserializer,
|
__deserializer,
|
||||||
@ -1954,11 +1964,13 @@ fn deserialize_generated_identifier(
|
|||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
#[doc(hidden)]
|
||||||
enum __Field #lifetime {
|
enum __Field #lifetime {
|
||||||
#(#field_idents,)*
|
#(#field_idents,)*
|
||||||
#ignore_variant
|
#ignore_variant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __FieldVisitor;
|
struct __FieldVisitor;
|
||||||
|
|
||||||
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
|
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
|
||||||
@ -2046,11 +2058,13 @@ fn deserialize_custom_identifier(
|
|||||||
None
|
None
|
||||||
} else if is_variant {
|
} else if is_variant {
|
||||||
let variants = quote! {
|
let variants = quote! {
|
||||||
|
#[doc(hidden)]
|
||||||
const VARIANTS: &'static [&'static str] = &[ #(#names),* ];
|
const VARIANTS: &'static [&'static str] = &[ #(#names),* ];
|
||||||
};
|
};
|
||||||
Some(variants)
|
Some(variants)
|
||||||
} else {
|
} else {
|
||||||
let fields = quote! {
|
let fields = quote! {
|
||||||
|
#[doc(hidden)]
|
||||||
const FIELDS: &'static [&'static str] = &[ #(#names),* ];
|
const FIELDS: &'static [&'static str] = &[ #(#names),* ];
|
||||||
};
|
};
|
||||||
Some(fields)
|
Some(fields)
|
||||||
@ -2072,6 +2086,7 @@ fn deserialize_custom_identifier(
|
|||||||
quote_block! {
|
quote_block! {
|
||||||
#names_const
|
#names_const
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
struct __FieldVisitor #de_impl_generics #where_clause {
|
struct __FieldVisitor #de_impl_generics #where_clause {
|
||||||
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
marker: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
lifetime: _serde::__private::PhantomData<&#delife ()>,
|
||||||
@ -2406,6 +2421,7 @@ fn deserialize_struct_as_struct_visitor(
|
|||||||
.flat_map(|(_, _, aliases)| aliases);
|
.flat_map(|(_, _, aliases)| aliases);
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2684,6 +2700,7 @@ fn deserialize_struct_as_struct_in_place_visitor(
|
|||||||
let fields_stmt = {
|
let fields_stmt = {
|
||||||
let field_names = field_names_idents.iter().map(|(name, _, _)| name);
|
let field_names = field_names_idents.iter().map(|(name, _, _)| name);
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
const FIELDS: &'static [&'static str] = &[ #(#field_names),* ];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2864,6 +2881,7 @@ fn wrap_deserialize_with(
|
|||||||
let delife = params.borrowed.de_lifetime();
|
let delife = params.borrowed.de_lifetime();
|
||||||
|
|
||||||
let wrapper = quote! {
|
let wrapper = quote! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __DeserializeWith #de_impl_generics #where_clause {
|
struct __DeserializeWith #de_impl_generics #where_clause {
|
||||||
value: #value_ty,
|
value: #value_ty,
|
||||||
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
|
@ -719,6 +719,7 @@ fn serialize_adjacently_tagged_variant(
|
|||||||
let (wrapper_impl_generics, wrapper_ty_generics, _) = wrapper_generics.split_for_impl();
|
let (wrapper_impl_generics, wrapper_ty_generics, _) = wrapper_generics.split_for_impl();
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __AdjacentlyTagged #wrapper_generics #where_clause {
|
struct __AdjacentlyTagged #wrapper_generics #where_clause {
|
||||||
data: (#(&'__a #fields_ty,)*),
|
data: (#(&'__a #fields_ty,)*),
|
||||||
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
@ -982,6 +983,7 @@ fn serialize_struct_variant_with_flatten(
|
|||||||
let (wrapper_impl_generics, wrapper_ty_generics, _) = wrapper_generics.split_for_impl();
|
let (wrapper_impl_generics, wrapper_ty_generics, _) = wrapper_generics.split_for_impl();
|
||||||
|
|
||||||
quote_block! {
|
quote_block! {
|
||||||
|
#[doc(hidden)]
|
||||||
struct __EnumFlatten #wrapper_generics #where_clause {
|
struct __EnumFlatten #wrapper_generics #where_clause {
|
||||||
data: (#(&'__a #fields_ty,)*),
|
data: (#(&'__a #fields_ty,)*),
|
||||||
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
@ -1212,6 +1214,7 @@ fn wrap_serialize_with(
|
|||||||
});
|
});
|
||||||
|
|
||||||
quote!({
|
quote!({
|
||||||
|
#[doc(hidden)]
|
||||||
struct __SerializeWith #wrapper_impl_generics #where_clause {
|
struct __SerializeWith #wrapper_impl_generics #where_clause {
|
||||||
values: (#(&'__a #field_tys, )*),
|
values: (#(&'__a #field_tys, )*),
|
||||||
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||||
|
Loading…
Reference in New Issue
Block a user