// @generated impl serde::Serialize for MetadataKey { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if !self.key.is_empty() { len += 1; } if !self.path.is_empty() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKey", len)?; if !self.key.is_empty() { struct_ser.serialize_field("key", &self.key)?; } if !self.path.is_empty() { struct_ser.serialize_field("path", &self.path)?; } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for MetadataKey { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "key", "path", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Key, Path, } 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 { "key" => Ok(GeneratedField::Key), "path" => Ok(GeneratedField::Path), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = MetadataKey; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKey") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut key__ = None; let mut path__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Key => { if key__.is_some() { return Err(serde::de::Error::duplicate_field("key")); } key__ = Some(map.next_value()?); } GeneratedField::Path => { if path__.is_some() { return Err(serde::de::Error::duplicate_field("path")); } path__ = Some(map.next_value()?); } } } Ok(MetadataKey { key: key__.unwrap_or_default(), path: path__.unwrap_or_default(), }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKey", FIELDS, GeneratedVisitor) } } impl serde::Serialize for metadata_key::PathSegment { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if self.segment.is_some() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKey.PathSegment", len)?; if let Some(v) = self.segment.as_ref() { match v { metadata_key::path_segment::Segment::Key(v) => { struct_ser.serialize_field("key", v)?; } } } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for metadata_key::PathSegment { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "key", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Key, } 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 { "key" => Ok(GeneratedField::Key), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = metadata_key::PathSegment; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKey.PathSegment") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut segment__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Key => { if segment__.is_some() { return Err(serde::de::Error::duplicate_field("key")); } segment__ = map.next_value::<::std::option::Option<_>>()?.map(metadata_key::path_segment::Segment::Key); } } } Ok(metadata_key::PathSegment { segment: segment__, }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKey.PathSegment", FIELDS, GeneratedVisitor) } } impl serde::Serialize for MetadataKind { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if self.kind.is_some() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKind", len)?; if let Some(v) = self.kind.as_ref() { match v { metadata_kind::Kind::Request(v) => { struct_ser.serialize_field("request", v)?; } metadata_kind::Kind::Route(v) => { struct_ser.serialize_field("route", v)?; } metadata_kind::Kind::Cluster(v) => { struct_ser.serialize_field("cluster", v)?; } metadata_kind::Kind::Host(v) => { struct_ser.serialize_field("host", v)?; } } } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for MetadataKind { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "request", "route", "cluster", "host", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Request, Route, Cluster, Host, } 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 { "request" => Ok(GeneratedField::Request), "route" => Ok(GeneratedField::Route), "cluster" => Ok(GeneratedField::Cluster), "host" => Ok(GeneratedField::Host), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = MetadataKind; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKind") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut kind__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Request => { if kind__.is_some() { return Err(serde::de::Error::duplicate_field("request")); } kind__ = map.next_value::<::std::option::Option<_>>()?.map(metadata_kind::Kind::Request) ; } GeneratedField::Route => { if kind__.is_some() { return Err(serde::de::Error::duplicate_field("route")); } kind__ = map.next_value::<::std::option::Option<_>>()?.map(metadata_kind::Kind::Route) ; } GeneratedField::Cluster => { if kind__.is_some() { return Err(serde::de::Error::duplicate_field("cluster")); } kind__ = map.next_value::<::std::option::Option<_>>()?.map(metadata_kind::Kind::Cluster) ; } GeneratedField::Host => { if kind__.is_some() { return Err(serde::de::Error::duplicate_field("host")); } kind__ = map.next_value::<::std::option::Option<_>>()?.map(metadata_kind::Kind::Host) ; } } } Ok(MetadataKind { kind: kind__, }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKind", FIELDS, GeneratedVisitor) } } impl serde::Serialize for metadata_kind::Cluster { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let len = 0; let struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKind.Cluster", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for metadata_kind::Cluster { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { } 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, { Err(serde::de::Error::unknown_field(value, FIELDS)) } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = metadata_kind::Cluster; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKind.Cluster") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { while map.next_key::()?.is_some() { let _ = map.next_value::()?; } Ok(metadata_kind::Cluster { }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKind.Cluster", FIELDS, GeneratedVisitor) } } impl serde::Serialize for metadata_kind::Host { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let len = 0; let struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKind.Host", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for metadata_kind::Host { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { } 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, { Err(serde::de::Error::unknown_field(value, FIELDS)) } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = metadata_kind::Host; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKind.Host") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { while map.next_key::()?.is_some() { let _ = map.next_value::()?; } Ok(metadata_kind::Host { }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKind.Host", FIELDS, GeneratedVisitor) } } impl serde::Serialize for metadata_kind::Request { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let len = 0; let struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKind.Request", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for metadata_kind::Request { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { } 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, { Err(serde::de::Error::unknown_field(value, FIELDS)) } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = metadata_kind::Request; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKind.Request") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { while map.next_key::()?.is_some() { let _ = map.next_value::()?; } Ok(metadata_kind::Request { }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKind.Request", FIELDS, GeneratedVisitor) } } impl serde::Serialize for metadata_kind::Route { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let len = 0; let struct_ser = serializer.serialize_struct("envoy.r#type.metadata.v2.MetadataKind.Route", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for metadata_kind::Route { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { } 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, { Err(serde::de::Error::unknown_field(value, FIELDS)) } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = metadata_kind::Route; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.metadata.v2.MetadataKind.Route") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { while map.next_key::()?.is_some() { let _ = map.next_value::()?; } Ok(metadata_kind::Route { }) } } deserializer.deserialize_struct("envoy.r#type.metadata.v2.MetadataKind.Route", FIELDS, GeneratedVisitor) } }