aws_sdk_glue/schema_serde/
shape_event_batching_condition.rs1static EVENTBATCHINGCONDITION_MEMBER_BATCH_SIZE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3 ::aws_smithy_schema::ShapeId::from_parts(
4 "com.amazonaws.glue#EventBatchingCondition$BatchSize",
5 "com.amazonaws.glue",
6 "EventBatchingCondition",
7 ),
8 ::aws_smithy_schema::ShapeType::Integer,
9 "BatchSize",
10 0,
11);
12static EVENTBATCHINGCONDITION_MEMBER_BATCH_WINDOW: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13 ::aws_smithy_schema::ShapeId::from_parts(
14 "com.amazonaws.glue#EventBatchingCondition$BatchWindow",
15 "com.amazonaws.glue",
16 "EventBatchingCondition",
17 ),
18 ::aws_smithy_schema::ShapeType::Integer,
19 "BatchWindow",
20 1,
21);
22static EVENTBATCHINGCONDITION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
23 ::aws_smithy_schema::ShapeId::from_parts(
24 "com.amazonaws.glue#EventBatchingCondition",
25 "com.amazonaws.glue",
26 "EventBatchingCondition",
27 ),
28 ::aws_smithy_schema::ShapeType::Structure,
29 &[&EVENTBATCHINGCONDITION_MEMBER_BATCH_SIZE, &EVENTBATCHINGCONDITION_MEMBER_BATCH_WINDOW],
30);
31impl crate::types::EventBatchingCondition {
32 pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &EVENTBATCHINGCONDITION_SCHEMA;
34}
35impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::EventBatchingCondition {
36 fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
37 Self::SCHEMA
38 }
39
40 #[allow(unused_variables, clippy::diverging_sub_expression)]
41 fn serialize_members(
42 &self,
43 ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
44 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
45 {
46 let val = &self.batch_size;
47 ser.write_integer(&EVENTBATCHINGCONDITION_MEMBER_BATCH_SIZE, *val)?;
48 }
49 if let Some(ref val) = self.batch_window {
50 ser.write_integer(&EVENTBATCHINGCONDITION_MEMBER_BATCH_WINDOW, *val)?;
51 }
52 Ok(())
53 }
54}
55impl crate::types::builders::EventBatchingConditionBuilder {
56 #[allow(
57 unused_variables,
58 unreachable_code,
59 clippy::single_match,
60 clippy::match_single_binding,
61 clippy::diverging_sub_expression
62 )]
63 pub(crate) fn deserialize_members(
64 &mut self,
65 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
66 ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
67 deserializer.read_struct(&EVENTBATCHINGCONDITION_SCHEMA, &mut |member, deser| {
68 match member.member_index() {
69 Some(0) => {
70 self.batch_size = Some(deser.read_integer(member)?);
71 }
72 Some(1) => {
73 if deser.is_null() {
74 deser.read_null()?;
75 } else {
76 self.batch_window = Some(deser.read_integer(member)?);
77 }
78 }
79 _ => {}
80 }
81 Ok(())
82 })
83 }
84}
85
86impl crate::types::EventBatchingCondition {
87 pub fn deserialize(
89 deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
90 ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
91 let mut builder = Self::builder();
92 builder.deserialize_members(deserializer)?;
93 builder.batch_size = builder.batch_size.or(Some(0i32));
94 builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
95 }
96}