// @generated impl serde::Serialize for Status { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if self.code != 0 { len += 1; } if !self.message.is_empty() { len += 1; } if !self.details.is_empty() { len += 1; } let mut struct_ser = serializer.serialize_struct("google.rpc.Status", len)?; if self.code != 0 { struct_ser.serialize_field("code", &self.code)?; } if !self.message.is_empty() { struct_ser.serialize_field("message", &self.message)?; } if !self.details.is_empty() { struct_ser.serialize_field("details", &self.details)?; } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for Status { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "code", "message", "details", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Code, Message, Details, } impl<'de> serde::Deserialize<'de> for GeneratedField { fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = GeneratedField; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "expected one of: {:?}", &FIELDS) } #[allow(unused_variables)] fn visit_str(self, value: &str) -> std::result::Result where E: serde::de::Error, { match value { "code" => Ok(GeneratedField::Code), "message" => Ok(GeneratedField::Message), "details" => Ok(GeneratedField::Details), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = Status; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct google.rpc.Status") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut code__ = None; let mut message__ = None; let mut details__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Code => { if code__.is_some() { return Err(serde::de::Error::duplicate_field("code")); } code__ = Some(map.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } GeneratedField::Message => { if message__.is_some() { return Err(serde::de::Error::duplicate_field("message")); } message__ = Some(map.next_value()?); } GeneratedField::Details => { if details__.is_some() { return Err(serde::de::Error::duplicate_field("details")); } details__ = Some(map.next_value()?); } } } Ok(Status { code: code__.unwrap_or_default(), message: message__.unwrap_or_default(), details: details__.unwrap_or_default(), }) } } deserializer.deserialize_struct("google.rpc.Status", FIELDS, GeneratedVisitor) } }