aws_sdk_workdocs/protocol_serde/
shape_concurrent_modification_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_concurrent_modification_exception_json_err(
3    value: &[u8],
4    mut builder: crate::types::error::builders::ConcurrentModificationExceptionBuilder,
5) -> ::std::result::Result<
6    crate::types::error::builders::ConcurrentModificationExceptionBuilder,
7    ::aws_smithy_json::deserialize::error::DeserializeError,
8> {
9    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
10    let tokens = &mut tokens_owned;
11    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
12    loop {
13        match tokens.next().transpose()? {
14            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
15            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
16                "Message" => {
17                    builder = builder.set_message(
18                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
19                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
20                            .transpose()?,
21                    );
22                }
23                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
24            },
25            other => {
26                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
27                    "expected object key or end object, found: {:?}",
28                    other
29                )))
30            }
31        }
32    }
33    if tokens.next().is_some() {
34        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
35            "found more JSON tokens after completing parsing",
36        ));
37    }
38    Ok(builder)
39}