2019-10-31 13:32:34 -05:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
pub struct GenericStruct<T> {
|
|
|
|
x: T,
|
|
|
|
}
|
2020-05-05 19:22:53 -05:00
|
|
|
#[doc(hidden)]
|
2019-10-31 13:32:34 -05:00
|
|
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
2020-06-07 00:41:07 -05:00
|
|
|
const _: () = {
|
2020-05-05 19:22:53 -05:00
|
|
|
#[allow(rust_2018_idioms, clippy::useless_attribute)]
|
2019-10-31 13:32:34 -05:00
|
|
|
extern crate serde as _serde;
|
|
|
|
#[automatically_derived]
|
|
|
|
impl<T> _serde::Serialize for GenericStruct<T>
|
|
|
|
where
|
|
|
|
T: _serde::Serialize,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
fn serialize<__S>(
|
|
|
|
&self,
|
|
|
|
__serializer: __S,
|
|
|
|
) -> _serde::__private::Result<__S::Ok, __S::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__S: _serde::Serializer,
|
|
|
|
{
|
|
|
|
let mut __serde_state = match _serde::Serializer::serialize_struct(
|
|
|
|
__serializer,
|
|
|
|
"GenericStruct",
|
|
|
|
false as usize + 1,
|
|
|
|
) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "x", &self.x) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
_serde::ser::SerializeStruct::end(__serde_state)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-05-05 19:22:53 -05:00
|
|
|
#[doc(hidden)]
|
2019-10-31 13:32:34 -05:00
|
|
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
2020-06-07 00:41:07 -05:00
|
|
|
const _: () = {
|
2020-05-05 19:22:53 -05:00
|
|
|
#[allow(rust_2018_idioms, clippy::useless_attribute)]
|
2019-10-31 13:32:34 -05:00
|
|
|
extern crate serde as _serde;
|
|
|
|
#[automatically_derived]
|
|
|
|
impl<'de, T> _serde::Deserialize<'de> for GenericStruct<T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
enum __Field {
|
|
|
|
__field0,
|
|
|
|
__ignore,
|
|
|
|
}
|
|
|
|
struct __FieldVisitor;
|
|
|
|
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
|
|
|
|
type Value = __Field;
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(__formatter, "field identifier")
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
0u64 => _serde::__private::Ok(__Field::__field0),
|
2021-01-23 21:45:15 -06:00
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
fn visit_str<__E>(
|
|
|
|
self,
|
|
|
|
__value: &str,
|
|
|
|
) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
"x" => _serde::__private::Ok(__Field::__field0),
|
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fn visit_bytes<__E>(
|
|
|
|
self,
|
|
|
|
__value: &[u8],
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
b"x" => _serde::__private::Ok(__Field::__field0),
|
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'de> _serde::Deserialize<'de> for __Field {
|
|
|
|
#[inline]
|
2021-01-08 21:35:52 -06:00
|
|
|
fn deserialize<__D>(
|
|
|
|
__deserializer: __D,
|
|
|
|
) -> _serde::__private::Result<Self, __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct __Visitor<'de, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
marker: _serde::__private::PhantomData<GenericStruct<T>>,
|
|
|
|
lifetime: _serde::__private::PhantomData<&'de ()>,
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
impl<'de, T> _serde::de::Visitor<'de> for __Visitor<'de, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
type Value = GenericStruct<T>;
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(__formatter, "struct GenericStruct")
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_seq<__A>(
|
|
|
|
self,
|
|
|
|
mut __seq: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::SeqAccess<'de>,
|
|
|
|
{
|
|
|
|
let __field0 = match match _serde::de::SeqAccess::next_element::<T>(&mut __seq)
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
} {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Some(__value) => __value,
|
|
|
|
_serde::__private::None => {
|
|
|
|
return _serde::__private::Err(_serde::de::Error::invalid_length(
|
2019-10-31 13:32:34 -05:00
|
|
|
0usize,
|
|
|
|
&"struct GenericStruct with 1 element",
|
|
|
|
));
|
|
|
|
}
|
|
|
|
};
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(GenericStruct { x: __field0 })
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_map<__A>(
|
|
|
|
self,
|
|
|
|
mut __map: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::MapAccess<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
let mut __field0: _serde::__private::Option<T> = _serde::__private::None;
|
|
|
|
while let _serde::__private::Some(__key) =
|
2019-10-31 13:32:34 -05:00
|
|
|
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
match __key {
|
|
|
|
__Field::__field0 => {
|
2021-01-08 21:35:52 -06:00
|
|
|
if _serde::__private::Option::is_some(&__field0) {
|
|
|
|
return _serde::__private::Err(
|
2019-10-31 13:32:34 -05:00
|
|
|
<__A::Error as _serde::de::Error>::duplicate_field("x"),
|
|
|
|
);
|
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
__field0 = _serde::__private::Some(
|
2019-10-31 13:32:34 -05:00
|
|
|
match _serde::de::MapAccess::next_value::<T>(&mut __map) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
_ => {
|
|
|
|
let _ = match _serde::de::MapAccess::next_value::<
|
|
|
|
_serde::de::IgnoredAny,
|
|
|
|
>(&mut __map)
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let __field0 = match __field0 {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Some(__field0) => __field0,
|
|
|
|
_serde::__private::None => {
|
|
|
|
match _serde::__private::de::missing_field("x") {
|
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
|
|
|
}
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
}
|
2019-10-31 13:32:34 -05:00
|
|
|
};
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(GenericStruct { x: __field0 })
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
const FIELDS: &'static [&'static str] = &["x"];
|
|
|
|
_serde::Deserializer::deserialize_struct(
|
|
|
|
__deserializer,
|
|
|
|
"GenericStruct",
|
|
|
|
FIELDS,
|
|
|
|
__Visitor {
|
2021-01-08 21:35:52 -06:00
|
|
|
marker: _serde::__private::PhantomData::<GenericStruct<T>>,
|
|
|
|
lifetime: _serde::__private::PhantomData,
|
2019-10-31 13:32:34 -05:00
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
fn deserialize_in_place<__D>(
|
|
|
|
__deserializer: __D,
|
|
|
|
__place: &mut Self,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<(), __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
enum __Field {
|
|
|
|
__field0,
|
|
|
|
__ignore,
|
|
|
|
}
|
|
|
|
struct __FieldVisitor;
|
|
|
|
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
|
|
|
|
type Value = __Field;
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(__formatter, "field identifier")
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
0u64 => _serde::__private::Ok(__Field::__field0),
|
2021-01-23 21:45:15 -06:00
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
fn visit_str<__E>(
|
|
|
|
self,
|
|
|
|
__value: &str,
|
|
|
|
) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
"x" => _serde::__private::Ok(__Field::__field0),
|
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fn visit_bytes<__E>(
|
|
|
|
self,
|
|
|
|
__value: &[u8],
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __E>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::de::Error,
|
|
|
|
{
|
|
|
|
match __value {
|
2021-01-08 21:35:52 -06:00
|
|
|
b"x" => _serde::__private::Ok(__Field::__field0),
|
|
|
|
_ => _serde::__private::Ok(__Field::__ignore),
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl<'de> _serde::Deserialize<'de> for __Field {
|
|
|
|
#[inline]
|
2021-01-08 21:35:52 -06:00
|
|
|
fn deserialize<__D>(
|
|
|
|
__deserializer: __D,
|
|
|
|
) -> _serde::__private::Result<Self, __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct __Visitor<'de, 'place, T: 'place>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
place: &'place mut GenericStruct<T>,
|
2021-01-08 21:35:52 -06:00
|
|
|
lifetime: _serde::__private::PhantomData<&'de ()>,
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
impl<'de, 'place, T: 'place> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
type Value = ();
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(__formatter, "struct GenericStruct")
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_seq<__A>(
|
|
|
|
self,
|
|
|
|
mut __seq: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::SeqAccess<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed(
|
2019-10-31 13:32:34 -05:00
|
|
|
&mut __seq,
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::de::InPlaceSeed(&mut self.place.x),
|
2019-10-31 13:32:34 -05:00
|
|
|
) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
} {
|
2021-01-08 21:35:52 -06:00
|
|
|
return _serde::__private::Err(_serde::de::Error::invalid_length(
|
2019-10-31 13:32:34 -05:00
|
|
|
0usize,
|
|
|
|
&"struct GenericStruct with 1 element",
|
|
|
|
));
|
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(())
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_map<__A>(
|
|
|
|
self,
|
|
|
|
mut __map: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::MapAccess<'de>,
|
|
|
|
{
|
|
|
|
let mut __field0: bool = false;
|
2021-01-08 21:35:52 -06:00
|
|
|
while let _serde::__private::Some(__key) =
|
2019-10-31 13:32:34 -05:00
|
|
|
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
match __key {
|
|
|
|
__Field::__field0 => {
|
|
|
|
if __field0 {
|
2021-01-08 21:35:52 -06:00
|
|
|
return _serde::__private::Err(
|
2019-10-31 13:32:34 -05:00
|
|
|
<__A::Error as _serde::de::Error>::duplicate_field("x"),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
match _serde::de::MapAccess::next_value_seed(
|
|
|
|
&mut __map,
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::de::InPlaceSeed(&mut self.place.x),
|
2019-10-31 13:32:34 -05:00
|
|
|
) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
__field0 = true;
|
|
|
|
}
|
|
|
|
_ => {
|
|
|
|
let _ = match _serde::de::MapAccess::next_value::<
|
|
|
|
_serde::de::IgnoredAny,
|
|
|
|
>(&mut __map)
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !__field0 {
|
2021-01-08 21:35:52 -06:00
|
|
|
self.place.x = match _serde::__private::de::missing_field("x") {
|
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(())
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
const FIELDS: &'static [&'static str] = &["x"];
|
|
|
|
_serde::Deserializer::deserialize_struct(
|
|
|
|
__deserializer,
|
|
|
|
"GenericStruct",
|
|
|
|
FIELDS,
|
|
|
|
__Visitor {
|
|
|
|
place: __place,
|
2021-01-08 21:35:52 -06:00
|
|
|
lifetime: _serde::__private::PhantomData,
|
2019-10-31 13:32:34 -05:00
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
pub struct GenericNewTypeStruct<T>(T);
|
2020-05-05 19:22:53 -05:00
|
|
|
#[doc(hidden)]
|
2019-10-31 13:32:34 -05:00
|
|
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
2020-06-07 00:41:07 -05:00
|
|
|
const _: () = {
|
2020-05-05 19:22:53 -05:00
|
|
|
#[allow(rust_2018_idioms, clippy::useless_attribute)]
|
2019-10-31 13:32:34 -05:00
|
|
|
extern crate serde as _serde;
|
|
|
|
#[automatically_derived]
|
|
|
|
impl<T> _serde::Serialize for GenericNewTypeStruct<T>
|
|
|
|
where
|
|
|
|
T: _serde::Serialize,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
fn serialize<__S>(
|
|
|
|
&self,
|
|
|
|
__serializer: __S,
|
|
|
|
) -> _serde::__private::Result<__S::Ok, __S::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__S: _serde::Serializer,
|
|
|
|
{
|
|
|
|
_serde::Serializer::serialize_newtype_struct(
|
|
|
|
__serializer,
|
|
|
|
"GenericNewTypeStruct",
|
|
|
|
&self.0,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-05-05 19:22:53 -05:00
|
|
|
#[doc(hidden)]
|
2019-10-31 13:32:34 -05:00
|
|
|
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
|
2020-06-07 00:41:07 -05:00
|
|
|
const _: () = {
|
2020-05-05 19:22:53 -05:00
|
|
|
#[allow(rust_2018_idioms, clippy::useless_attribute)]
|
2019-10-31 13:32:34 -05:00
|
|
|
extern crate serde as _serde;
|
|
|
|
#[automatically_derived]
|
|
|
|
impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct<T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
struct __Visitor<'de, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
marker: _serde::__private::PhantomData<GenericNewTypeStruct<T>>,
|
|
|
|
lifetime: _serde::__private::PhantomData<&'de ()>,
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
impl<'de, T> _serde::de::Visitor<'de> for __Visitor<'de, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
type Value = GenericNewTypeStruct<T>;
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(
|
2019-10-31 13:32:34 -05:00
|
|
|
__formatter,
|
|
|
|
"tuple struct GenericNewTypeStruct",
|
|
|
|
)
|
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_newtype_struct<__E>(
|
|
|
|
self,
|
|
|
|
__e: __E,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __E::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
let __field0: T = match <T as _serde::Deserialize>::deserialize(__e) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
};
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(GenericNewTypeStruct(__field0))
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_seq<__A>(
|
|
|
|
self,
|
|
|
|
mut __seq: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::SeqAccess<'de>,
|
|
|
|
{
|
|
|
|
let __field0 = match match _serde::de::SeqAccess::next_element::<T>(&mut __seq)
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
} {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Some(__value) => __value,
|
|
|
|
_serde::__private::None => {
|
|
|
|
return _serde::__private::Err(_serde::de::Error::invalid_length(
|
2019-10-31 13:32:34 -05:00
|
|
|
0usize,
|
|
|
|
&"tuple struct GenericNewTypeStruct with 1 element",
|
|
|
|
));
|
|
|
|
}
|
|
|
|
};
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(GenericNewTypeStruct(__field0))
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_serde::Deserializer::deserialize_newtype_struct(
|
|
|
|
__deserializer,
|
|
|
|
"GenericNewTypeStruct",
|
|
|
|
__Visitor {
|
2021-01-08 21:35:52 -06:00
|
|
|
marker: _serde::__private::PhantomData::<GenericNewTypeStruct<T>>,
|
|
|
|
lifetime: _serde::__private::PhantomData,
|
2019-10-31 13:32:34 -05:00
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
fn deserialize_in_place<__D>(
|
|
|
|
__deserializer: __D,
|
|
|
|
__place: &mut Self,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<(), __D::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__D: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
struct __Visitor<'de, 'place, T: 'place>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
place: &'place mut GenericNewTypeStruct<T>,
|
2021-01-08 21:35:52 -06:00
|
|
|
lifetime: _serde::__private::PhantomData<&'de ()>,
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
impl<'de, 'place, T: 'place> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T>
|
|
|
|
where
|
|
|
|
T: _serde::Deserialize<'de>,
|
|
|
|
{
|
|
|
|
type Value = ();
|
|
|
|
fn expecting(
|
|
|
|
&self,
|
2021-01-08 21:35:52 -06:00
|
|
|
__formatter: &mut _serde::__private::Formatter,
|
|
|
|
) -> _serde::__private::fmt::Result {
|
|
|
|
_serde::__private::Formatter::write_str(
|
2019-10-31 13:32:34 -05:00
|
|
|
__formatter,
|
|
|
|
"tuple struct GenericNewTypeStruct",
|
|
|
|
)
|
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_newtype_struct<__E>(
|
|
|
|
self,
|
|
|
|
__e: __E,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __E::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__E: _serde::Deserializer<'de>,
|
|
|
|
{
|
|
|
|
_serde::Deserialize::deserialize_in_place(__e, &mut self.place.0)
|
|
|
|
}
|
|
|
|
#[inline]
|
|
|
|
fn visit_seq<__A>(
|
|
|
|
self,
|
|
|
|
mut __seq: __A,
|
2021-01-08 21:35:52 -06:00
|
|
|
) -> _serde::__private::Result<Self::Value, __A::Error>
|
2019-10-31 13:32:34 -05:00
|
|
|
where
|
|
|
|
__A: _serde::de::SeqAccess<'de>,
|
|
|
|
{
|
2021-01-08 21:35:52 -06:00
|
|
|
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed(
|
2019-10-31 13:32:34 -05:00
|
|
|
&mut __seq,
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::de::InPlaceSeed(&mut self.place.0),
|
2019-10-31 13:32:34 -05:00
|
|
|
) {
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(__val) => __val,
|
|
|
|
_serde::__private::Err(__err) => {
|
|
|
|
return _serde::__private::Err(__err);
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
} {
|
2021-01-08 21:35:52 -06:00
|
|
|
return _serde::__private::Err(_serde::de::Error::invalid_length(
|
2019-10-31 13:32:34 -05:00
|
|
|
0usize,
|
|
|
|
&"tuple struct GenericNewTypeStruct with 1 element",
|
|
|
|
));
|
|
|
|
}
|
2021-01-08 21:35:52 -06:00
|
|
|
_serde::__private::Ok(())
|
2019-10-31 13:32:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_serde::Deserializer::deserialize_newtype_struct(
|
|
|
|
__deserializer,
|
|
|
|
"GenericNewTypeStruct",
|
|
|
|
__Visitor {
|
|
|
|
place: __place,
|
2021-01-08 21:35:52 -06:00
|
|
|
lifetime: _serde::__private::PhantomData,
|
2019-10-31 13:32:34 -05:00
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2019-11-03 06:08:39 -06:00
|
|
|
};
|