aws_sdk_ssooidc/protocol_serde/
shape_scopes.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_scopes<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8    match tokens.next().transpose()? {
9        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
11            let mut items = Vec::new();
12            loop {
13                match tokens.peek() {
14                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
15                        tokens.next().transpose().unwrap();
16                        break;
17                    }
18                    _ => {
19                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21                            .transpose()?;
22                        if let Some(value) = value {
23                            items.push(value);
24                        }
25                    }
26                }
27            }
28            Ok(Some(items))
29        }
30        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
31            "expected start array or null",
32        )),
33    }
34}