Merge pull request #1962 from serde-rs/dupborrowed

Eliminate duplicated borrowed and non-borrowed identifier deserialization
This commit is contained in:
David Tolnay 2021-01-23 20:51:56 -08:00 committed by GitHub
commit 18e5b03fd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 60 additions and 488 deletions

View File

@ -1904,23 +1904,17 @@ fn deserialize_generated_identifier(
let (ignore_variant, fallthrough) = if !is_variant && cattrs.has_flatten() {
let ignore_variant = quote!(__other(_serde::__private::de::Content<'de>),);
let fallthrough = quote!(_serde::__private::Ok(__Field::__other(__value)));
(
Some(ignore_variant),
Some((fallthrough.clone(), fallthrough)),
)
(Some(ignore_variant), Some(fallthrough))
} else if let Some(other_idx) = other_idx {
let ignore_variant = fields[other_idx].1.clone();
let fallthrough = quote!(_serde::__private::Ok(__Field::#ignore_variant));
(None, Some((fallthrough.clone(), fallthrough)))
(None, Some(fallthrough))
} else if is_variant || cattrs.deny_unknown_fields() {
(None, None)
} else {
let ignore_variant = quote!(__ignore,);
let fallthrough = quote!(_serde::__private::Ok(__Field::__ignore));
(
Some(ignore_variant),
Some((fallthrough.clone(), fallthrough)),
)
(Some(ignore_variant), Some(fallthrough))
};
let visitor_impl = Stmts(deserialize_identifier(
@ -1928,6 +1922,7 @@ fn deserialize_generated_identifier(
fields,
is_variant,
fallthrough,
None,
!is_variant && cattrs.has_flatten(),
None,
));
@ -1981,7 +1976,7 @@ fn deserialize_custom_identifier(
let this = &params.this;
let this = quote!(#this);
let (ordinary, fallthrough) = if let Some(last) = variants.last() {
let (ordinary, fallthrough, fallthrough_borrowed) = if let Some(last) = variants.last() {
let last_ident = &last.ident;
if last.attrs.other() {
// Process `serde(other)` attribute. It would always be found on the
@ -1989,7 +1984,7 @@ fn deserialize_custom_identifier(
// are ordinary variants.
let ordinary = &variants[..variants.len() - 1];
let fallthrough = quote!(_serde::__private::Ok(#this::#last_ident));
(ordinary, Some((fallthrough.clone(), fallthrough)))
(ordinary, Some(fallthrough), None)
} else if let Style::Newtype = last.style {
let ordinary = &variants[..variants.len() - 1];
let fallthrough = |value| {
@ -2003,16 +1998,16 @@ fn deserialize_custom_identifier(
};
(
ordinary,
Some((
fallthrough(quote!(__value)),
fallthrough(quote!(_serde::__private::de::Borrowed(__value))),
)),
Some(fallthrough(quote!(__value))),
Some(fallthrough(quote!(_serde::__private::de::Borrowed(
__value
)))),
)
} else {
(variants, None)
(variants, None, None)
}
} else {
(variants, None)
(variants, None, None)
};
let names_idents: Vec<_> = ordinary
@ -2050,6 +2045,7 @@ fn deserialize_custom_identifier(
&names_idents,
is_variant,
fallthrough,
fallthrough_borrowed,
false,
cattrs.expecting(),
));
@ -2080,8 +2076,8 @@ fn deserialize_identifier(
this: &TokenStream,
fields: &[(String, Ident, Vec<String>)],
is_variant: bool,
// .0 for referenced data, .1 -- for borrowed
fallthrough: Option<(TokenStream, TokenStream)>,
fallthrough: Option<TokenStream>,
fallthrough_borrowed: Option<TokenStream>,
collect_other_fields: bool,
expecting: Option<&str>,
) -> Fragment {
@ -2145,22 +2141,19 @@ fn deserialize_identifier(
(None, None, None, None)
};
let (fallthrough_arm, fallthrough_borrowed_arm) = if let Some(fallthrough) = fallthrough.clone()
{
let fallthrough_arm = if let Some(fallthrough) = fallthrough.clone() {
fallthrough
} else if is_variant {
let fallthrough = quote! {
quote! {
_serde::__private::Err(_serde::de::Error::unknown_variant(__value, VARIANTS))
};
(fallthrough.clone(), fallthrough)
}
} else {
let fallthrough = quote! {
quote! {
_serde::__private::Err(_serde::de::Error::unknown_field(__value, FIELDS))
};
(fallthrough.clone(), fallthrough)
}
};
let u64_fallthrough_arm = if let Some((fallthrough, _)) = fallthrough {
let u64_fallthrough_arm = if let Some(fallthrough) = fallthrough {
fallthrough
} else {
let fallthrough_msg = format!("{} index 0 <= i < {}", index_expecting, fields.len());
@ -2282,6 +2275,44 @@ fn deserialize_identifier(
}
};
let visit_borrowed = if fallthrough_borrowed.is_some() || collect_other_fields {
let fallthrough_borrowed_arm = fallthrough_borrowed.as_ref().unwrap_or(&fallthrough_arm);
Some(quote! {
fn visit_borrowed_str<__E>(self, __value: &'de str) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
#(
#field_strs => _serde::__private::Ok(#constructors),
)*
_ => {
#value_as_borrowed_str_content
#fallthrough_borrowed_arm
}
}
}
fn visit_borrowed_bytes<__E>(self, __value: &'de [u8]) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
#(
#field_bytes => _serde::__private::Ok(#constructors),
)*
_ => {
#bytes_to_str
#value_as_borrowed_bytes_content
#fallthrough_borrowed_arm
}
}
}
})
} else {
None
};
quote_block! {
fn expecting(&self, __formatter: &mut _serde::__private::Formatter) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, #expecting)
@ -2304,21 +2335,6 @@ fn deserialize_identifier(
}
}
fn visit_borrowed_str<__E>(self, __value: &'de str) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
#(
#field_strs => _serde::__private::Ok(#constructors),
)*
_ => {
#value_as_borrowed_str_content
#fallthrough_borrowed_arm
}
}
}
fn visit_bytes<__E>(self, __value: &[u8]) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
@ -2335,21 +2351,7 @@ fn deserialize_identifier(
}
}
fn visit_borrowed_bytes<__E>(self, __value: &'de [u8]) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
#(
#field_bytes => _serde::__private::Ok(#constructors),
)*
_ => {
#bytes_to_str
#value_as_borrowed_bytes_content
#fallthrough_borrowed_arm
}
}
}
#visit_borrowed
}
}

View File

@ -332,25 +332,6 @@ const _: () = {
)),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"Unit" => _serde::__private::Ok(__Field::__field0),
"Seq" => _serde::__private::Ok(__Field::__field1),
"Map" => _serde::__private::Ok(__Field::__field2),
"_Unit2" => _serde::__private::Ok(__Field::__field3),
"_Seq2" => _serde::__private::Ok(__Field::__field4),
"_Map2" => _serde::__private::Ok(__Field::__field5),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
)),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -373,28 +354,6 @@ const _: () = {
}
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"Unit" => _serde::__private::Ok(__Field::__field0),
b"Seq" => _serde::__private::Ok(__Field::__field1),
b"Map" => _serde::__private::Ok(__Field::__field2),
b"_Unit2" => _serde::__private::Ok(__Field::__field3),
b"_Seq2" => _serde::__private::Ok(__Field::__field4),
b"_Map2" => _serde::__private::Ok(__Field::__field5),
_ => {
let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
))
}
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -632,21 +591,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
"b" => _serde::__private::Ok(__Field::__field1),
"c" => _serde::__private::Ok(__Field::__field2),
"d" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -662,21 +606,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
b"b" => _serde::__private::Ok(__Field::__field1),
b"c" => _serde::__private::Ok(__Field::__field2),
b"d" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -1165,21 +1094,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
"b" => _serde::__private::Ok(__Field::__field1),
"c" => _serde::__private::Ok(__Field::__field2),
"d" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -1195,21 +1109,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
b"b" => _serde::__private::Ok(__Field::__field1),
b"c" => _serde::__private::Ok(__Field::__field2),
b"d" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -92,18 +92,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"phantom" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -116,18 +104,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"phantom" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -296,18 +272,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"phantom" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -320,18 +284,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"phantom" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -174,23 +174,6 @@ const _: () = {
)),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"Unit" => _serde::__private::Ok(__Field::__field0),
"NewType" => _serde::__private::Ok(__Field::__field1),
"Seq" => _serde::__private::Ok(__Field::__field2),
"Map" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
)),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -211,26 +194,6 @@ const _: () = {
}
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"Unit" => _serde::__private::Ok(__Field::__field0),
b"NewType" => _serde::__private::Ok(__Field::__field1),
b"Seq" => _serde::__private::Ok(__Field::__field2),
b"Map" => _serde::__private::Ok(__Field::__field3),
_ => {
let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
))
}
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -410,19 +373,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"x" => _serde::__private::Ok(__Field::__field0),
"y" => _serde::__private::Ok(__Field::__field1),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -436,19 +386,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"x" => _serde::__private::Ok(__Field::__field0),
b"y" => _serde::__private::Ok(__Field::__field1),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -88,18 +88,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"x" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -112,18 +100,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"x" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -292,18 +268,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"x" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -316,18 +280,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"x" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -151,23 +151,6 @@ const _: () = {
)),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"LifetimeSeq" => _serde::__private::Ok(__Field::__field0),
"NoLifetimeSeq" => _serde::__private::Ok(__Field::__field1),
"LifetimeMap" => _serde::__private::Ok(__Field::__field2),
"NoLifetimeMap" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
)),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -188,26 +171,6 @@ const _: () = {
}
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"LifetimeSeq" => _serde::__private::Ok(__Field::__field0),
b"NoLifetimeSeq" => _serde::__private::Ok(__Field::__field1),
b"LifetimeMap" => _serde::__private::Ok(__Field::__field2),
b"NoLifetimeMap" => _serde::__private::Ok(__Field::__field3),
_ => {
let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
))
}
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -296,18 +259,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -320,18 +271,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -504,18 +443,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -528,18 +455,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -117,20 +117,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
"b" => _serde::__private::Ok(__Field::__field1),
"c" => _serde::__private::Ok(__Field::__field2),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -145,20 +131,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
b"b" => _serde::__private::Ok(__Field::__field1),
b"c" => _serde::__private::Ok(__Field::__field2),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]
@ -429,20 +401,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
"a" => _serde::__private::Ok(__Field::__field0),
"b" => _serde::__private::Ok(__Field::__field1),
"c" => _serde::__private::Ok(__Field::__field2),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -457,20 +415,6 @@ const _: () = {
_ => _serde::__private::Ok(__Field::__ignore),
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
b"a" => _serde::__private::Ok(__Field::__field0),
b"b" => _serde::__private::Ok(__Field::__field1),
b"c" => _serde::__private::Ok(__Field::__field2),
_ => _serde::__private::Ok(__Field::__ignore),
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]

View File

@ -64,19 +64,6 @@ const _: () = {
)),
}
}
fn visit_borrowed_str<__E>(
self,
__value: &'de str,
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
_ => _serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
)),
}
}
fn visit_bytes<__E>(
self,
__value: &[u8],
@ -93,22 +80,6 @@ const _: () = {
}
}
}
fn visit_borrowed_bytes<__E>(
self,
__value: &'de [u8],
) -> _serde::__private::Result<Self::Value, __E>
where
__E: _serde::de::Error,
{
match __value {
_ => {
let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant(
__value, VARIANTS,
))
}
}
}
}
impl<'de> _serde::Deserialize<'de> for __Field {
#[inline]