Skip to main content

aws_sdk_securityhub/protocol_serde/
shape_aws_s3_bucket_bucket_lifecycle_configuration_rules_filter_predicate_operands_list.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_aws_s3_bucket_bucket_lifecycle_configuration_rules_filter_predicate_operands_list<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4    _value: &'a [u8],
5) -> ::std::result::Result<
6    Option<::std::vec::Vec<crate::types::AwsS3BucketBucketLifecycleConfigurationRulesFilterPredicateOperandsDetails>>,
7    ::aws_smithy_json::deserialize::error::DeserializeError,
8>
9where
10    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
11{
12    match tokens.next().transpose()? {
13        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
14        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
15            let mut items = Vec::new();
16            loop {
17                match tokens.peek() {
18                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
19                        tokens.next().transpose().unwrap();
20                        break;
21                    }
22                    _ => {
23                        let value =
24                            crate::protocol_serde::shape_aws_s3_bucket_bucket_lifecycle_configuration_rules_filter_predicate_operands_details::de_aws_s3_bucket_bucket_lifecycle_configuration_rules_filter_predicate_operands_details(tokens, _value)?
25                        ;
26                        if let Some(value) = value {
27                            items.push(value);
28                        } else {
29                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
30                                "dense list cannot contain null values",
31                            ));
32                        }
33                    }
34                }
35            }
36            Ok(Some(items))
37        }
38        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
39            "expected start array or null",
40        )),
41    }
42}