// @generated impl serde::Serialize for Cookie { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if !self.name.is_empty() { len += 1; } if self.ttl.is_some() { len += 1; } if !self.path.is_empty() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.http.v3.Cookie", len)?; if !self.name.is_empty() { struct_ser.serialize_field("name", &self.name)?; } if let Some(v) = self.ttl.as_ref() { struct_ser.serialize_field("ttl", v)?; } if !self.path.is_empty() { struct_ser.serialize_field("path", &self.path)?; } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for Cookie { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "name", "ttl", "path", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Name, Ttl, 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 { "name" => Ok(GeneratedField::Name), "ttl" => Ok(GeneratedField::Ttl), "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 = Cookie; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.http.v3.Cookie") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut name__ = None; let mut ttl__ = None; let mut path__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Name => { if name__.is_some() { return Err(serde::de::Error::duplicate_field("name")); } name__ = Some(map.next_value()?); } GeneratedField::Ttl => { if ttl__.is_some() { return Err(serde::de::Error::duplicate_field("ttl")); } ttl__ = map.next_value()?; } GeneratedField::Path => { if path__.is_some() { return Err(serde::de::Error::duplicate_field("path")); } path__ = Some(map.next_value()?); } } } Ok(Cookie { name: name__.unwrap_or_default(), ttl: ttl__, path: path__.unwrap_or_default(), }) } } deserializer.deserialize_struct("envoy.r#type.http.v3.Cookie", FIELDS, GeneratedVisitor) } } impl serde::Serialize for PathTransformation { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if !self.operations.is_empty() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.http.v3.PathTransformation", len)?; if !self.operations.is_empty() { struct_ser.serialize_field("operations", &self.operations)?; } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for PathTransformation { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "operations", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Operations, } 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 { "operations" => Ok(GeneratedField::Operations), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = PathTransformation; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.http.v3.PathTransformation") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut operations__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::Operations => { if operations__.is_some() { return Err(serde::de::Error::duplicate_field("operations")); } operations__ = Some(map.next_value()?); } } } Ok(PathTransformation { operations: operations__.unwrap_or_default(), }) } } deserializer.deserialize_struct("envoy.r#type.http.v3.PathTransformation", FIELDS, GeneratedVisitor) } } impl serde::Serialize for path_transformation::Operation { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; if self.operation_specifier.is_some() { len += 1; } let mut struct_ser = serializer.serialize_struct("envoy.r#type.http.v3.PathTransformation.Operation", len)?; if let Some(v) = self.operation_specifier.as_ref() { match v { path_transformation::operation::OperationSpecifier::NormalizePathRfc3986(v) => { struct_ser.serialize_field("normalizePathRfc3986", v)?; } path_transformation::operation::OperationSpecifier::MergeSlashes(v) => { struct_ser.serialize_field("mergeSlashes", v)?; } } } struct_ser.end() } } impl<'de> serde::Deserialize<'de> for path_transformation::Operation { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ "normalize_path_rfc_3986", "normalizePathRfc3986", "merge_slashes", "mergeSlashes", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { NormalizePathRfc3986, MergeSlashes, } 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 { "normalizePathRfc3986" | "normalize_path_rfc_3986" => Ok(GeneratedField::NormalizePathRfc3986), "mergeSlashes" | "merge_slashes" => Ok(GeneratedField::MergeSlashes), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = path_transformation::Operation; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.http.v3.PathTransformation.Operation") } fn visit_map(self, mut map: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut operation_specifier__ = None; while let Some(k) = map.next_key()? { match k { GeneratedField::NormalizePathRfc3986 => { if operation_specifier__.is_some() { return Err(serde::de::Error::duplicate_field("normalizePathRfc3986")); } operation_specifier__ = map.next_value::<::std::option::Option<_>>()?.map(path_transformation::operation::OperationSpecifier::NormalizePathRfc3986) ; } GeneratedField::MergeSlashes => { if operation_specifier__.is_some() { return Err(serde::de::Error::duplicate_field("mergeSlashes")); } operation_specifier__ = map.next_value::<::std::option::Option<_>>()?.map(path_transformation::operation::OperationSpecifier::MergeSlashes) ; } } } Ok(path_transformation::Operation { operation_specifier: operation_specifier__, }) } } deserializer.deserialize_struct("envoy.r#type.http.v3.PathTransformation.Operation", FIELDS, GeneratedVisitor) } } impl serde::Serialize for path_transformation::operation::MergeSlashes { #[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.http.v3.PathTransformation.Operation.MergeSlashes", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for path_transformation::operation::MergeSlashes { #[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 = path_transformation::operation::MergeSlashes; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.http.v3.PathTransformation.Operation.MergeSlashes") } 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(path_transformation::operation::MergeSlashes { }) } } deserializer.deserialize_struct("envoy.r#type.http.v3.PathTransformation.Operation.MergeSlashes", FIELDS, GeneratedVisitor) } } impl serde::Serialize for path_transformation::operation::NormalizePathRfc3986 { #[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.http.v3.PathTransformation.Operation.NormalizePathRFC3986", len)?; struct_ser.end() } } impl<'de> serde::Deserialize<'de> for path_transformation::operation::NormalizePathRfc3986 { #[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 = path_transformation::operation::NormalizePathRfc3986; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { formatter.write_str("struct envoy.r#type.http.v3.PathTransformation.Operation.NormalizePathRFC3986") } 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(path_transformation::operation::NormalizePathRfc3986 { }) } } deserializer.deserialize_struct("envoy.r#type.http.v3.PathTransformation.Operation.NormalizePathRFC3986", FIELDS, GeneratedVisitor) } }