aws_sdk_s3/protocol_serde/
shape_metrics.rs
1pub fn ser_metrics(
3 input: &crate::types::Metrics,
4 writer: ::aws_smithy_xml::encode::ElWriter,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 #[allow(unused_mut)]
7 let mut scope = writer.finish();
8 {
9 let mut inner_writer = scope.start_el("Status").finish();
10 inner_writer.data(input.status.as_str());
11 }
12 if let Some(var_1) = &input.event_threshold {
13 let inner_writer = scope.start_el("EventThreshold");
14 crate::protocol_serde::shape_replication_time_value::ser_replication_time_value(var_1, inner_writer)?
15 }
16 scope.finish();
17 Ok(())
18}
19
20#[allow(clippy::needless_question_mark)]
21pub fn de_metrics(
22 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
23) -> ::std::result::Result<crate::types::Metrics, ::aws_smithy_xml::decode::XmlDecodeError> {
24 #[allow(unused_mut)]
25 let mut builder = crate::types::Metrics::builder();
26 while let Some(mut tag) = decoder.next_tag() {
27 match tag.start_el() {
28 s if s.matches("Status") => {
29 let var_2 =
30 Some(
31 Result::<crate::types::MetricsStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
32 crate::types::MetricsStatus::from(
33 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
34 )
35 )
36 ?
37 )
38 ;
39 builder = builder.set_status(var_2);
40 }
41 ,
42 s if s.matches("EventThreshold") => {
43 let var_3 =
44 Some(
45 crate::protocol_serde::shape_replication_time_value::de_replication_time_value(&mut tag)
46 ?
47 )
48 ;
49 builder = builder.set_event_threshold(var_3);
50 }
51 ,
52 _ => {}
53 }
54 }
55 Ok(crate::serde_util::metrics_correct_errors(builder)
56 .build()
57 .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
58}