Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_streaming_traits_require_length_input.rs

@@ -1,1 +6,11 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_blob_http_payload(
    3      4   
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4      5   
) -> ::std::result::Result<::aws_smithy_types::byte_stream::ByteStream, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    Ok(payload)
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
           7  +
    Ok(
           8  +
        /* HttpBoundProtocolPayloadGenerator.kt:374 */ payload, /* HttpBoundProtocolPayloadGenerator.kt:345 */
           9  +
    )
          10  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
    6     11   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_streaming_traits_with_media_type.rs

@@ -1,1 +64,90 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:200 */
    3      5   
pub fn de_streaming_traits_with_media_type_http_response(
    4      6   
    response: &mut ::aws_smithy_runtime_api::http::Response,
    5      7   
) -> std::result::Result<
    6      8   
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeOutput,
    7      9   
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError,
    8     10   
> {
          11  +
    /* ProtocolParserGenerator.kt:206 */
    9     12   
    let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
   10     13   
    std::mem::swap(&mut _response_body, response.body_mut());
   11     14   
    let _response_body = &mut _response_body;
   12     15   
   13     16   
    let _response_status = response.status().as_u16();
   14     17   
    let _response_headers = response.headers();
          18  +
    /* ProtocolParserGenerator.kt:217 */
   15     19   
    Ok({
          20  +
        /* RustType.kt:516 */
   16     21   
        #[allow(unused_mut)]
          22  +
        /* ProtocolParserGenerator.kt:240 */
   17     23   
        let mut output = crate::operation::streaming_traits_with_media_type::builders::StreamingTraitsWithMediaTypeOutputBuilder::default();
   18         -
        output = output.set_blob(Some(
          24  +
        /* ProtocolParserGenerator.kt:267 */
          25  +
        output = output.set_blob(/* ProtocolParserGenerator.kt:325 */ Some(
   19     26   
            crate::protocol_serde::shape_streaming_traits_with_media_type_output::de_blob_payload(_response_body)?,
   20         -
        ));
          27  +
        ) /* ProtocolParserGenerator.kt:267 */);
          28  +
        /* ProtocolParserGenerator.kt:267 */
   21     29   
        output = output.set_foo(
          30  +
            /* ProtocolParserGenerator.kt:302 */
   22     31   
            crate::protocol_serde::shape_streaming_traits_with_media_type_output::de_foo_header(_response_headers).map_err(|_| {
   23     32   
                crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::unhandled(
   24     33   
                    "Failed to parse foo from header `X-Foo",
   25     34   
                )
   26         -
            })?,
          35  +
            })?, /* ProtocolParserGenerator.kt:267 */
   27     36   
        );
          37  +
        /* ClientBuilderInstantiator.kt:56 */
   28     38   
        output.build()
          39  +
        /* ProtocolParserGenerator.kt:217 */
   29     40   
    })
          41  +
    /* ProtocolParserGenerator.kt:200 */
   30     42   
}
   31     43   
          44  +
/* RustType.kt:516 */
   32     45   
#[allow(clippy::unnecessary_wraps)]
          46  +
/* ProtocolParserGenerator.kt:99 */
   33     47   
pub fn de_streaming_traits_with_media_type_http_error(
   34     48   
    _response_status: u16,
   35     49   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   36     50   
    _response_body: &[u8],
   37     51   
) -> std::result::Result<
   38     52   
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeOutput,
   39     53   
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError,
   40     54   
> {
          55  +
    /* RustType.kt:516 */
   41     56   
    #[allow(unused_mut)]
          57  +
    /* ProtocolParserGenerator.kt:106 */
   42     58   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   43     59   
        .map_err(crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::unhandled)?;
          60  +
    /* ProtocolParserGenerator.kt:120 */
   44     61   
    let generic = generic_builder.build();
          62  +
    /* ProtocolParserGenerator.kt:185 */
   45     63   
    Err(crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::generic(generic))
          64  +
    /* ProtocolParserGenerator.kt:99 */
   46     65   
}
   47     66   
          67  +
/* HttpBindingGenerator.kt:542 */
   48     68   
pub fn ser_streaming_traits_with_media_type_headers(
   49     69   
    input: &crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeInput,
   50     70   
    mut builder: ::http::request::Builder,
   51     71   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          72  +
    /* HttpBindingGenerator.kt:592 */
   52     73   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
          74  +
        /* HttpBindingGenerator.kt:704 */
   53     75   
        let formatted_2 = inner_1.as_str();
          76  +
        /* HttpBindingGenerator.kt:706 */
   54     77   
        let header_value = formatted_2;
   55     78   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   56     79   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   57     80   
                "foo",
   58     81   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   59     82   
            )
   60     83   
        })?;
   61     84   
        builder = builder.header("X-Foo", header_value);
          85  +
        /* HttpBindingGenerator.kt:592 */
   62     86   
    }
          87  +
    /* HttpBindingGenerator.kt:555 */
   63     88   
    Ok(builder)
          89  +
    /* HttpBindingGenerator.kt:542 */
   64     90   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_streaming_traits_with_media_type_input.rs

@@ -1,1 +6,11 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_blob_http_payload(
    3      4   
    payload: ::aws_smithy_types::byte_stream::ByteStream,
    4      5   
) -> ::std::result::Result<::aws_smithy_types::byte_stream::ByteStream, ::aws_smithy_types::error::operation::BuildError> {
    5         -
    Ok(payload)
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
           7  +
    Ok(
           8  +
        /* HttpBoundProtocolPayloadGenerator.kt:374 */ payload, /* HttpBoundProtocolPayloadGenerator.kt:345 */
           9  +
    )
          10  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
    6     11   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_streaming_traits_with_media_type_output.rs

@@ -1,1 +18,24 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:230 */
    2      3   
pub fn de_blob_payload(
    3      4   
    body: &mut ::aws_smithy_types::body::SdkBody,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::byte_stream::ByteStream,
    6      7   
    crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError,
    7      8   
> {
    8         -
    // replace the body with an empty body
           9  +
    /* HttpBindingGenerator.kt:299 */// replace the body with an empty body
    9     10   
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
   10     11   
    Ok(::aws_smithy_types::byte_stream::ByteStream::new(body))
          12  +
    /* HttpBindingGenerator.kt:230 */
   11     13   
}
   12     14   
          15  +
/* HttpBindingGenerator.kt:153 */
   13     16   
pub(crate) fn de_foo_header(
   14     17   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     18   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          19  +
    /* HttpBindingGenerator.kt:160 */
   16     20   
    let headers = header_map.get_all("X-Foo");
          21  +
    /* HttpBindingGenerator.kt:375 */
   17     22   
    ::aws_smithy_http::header::one_or_none(headers)
          23  +
    /* HttpBindingGenerator.kt:153 */
   18     24   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_string_list.rs

@@ -1,1 +34,59 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_string_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   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()?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          31  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          32  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          33  +
                                /* JsonParserGenerator.kt:339 */)
          34  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          35  +
                        /* JsonParserGenerator.kt:419 */;
          36  +
                        /* JsonParserGenerator.kt:422 */
   22     37   
                        if let Some(value) = value {
   23     38   
                            items.push(value);
   24     39   
                        }
          40  +
                        /* JsonParserGenerator.kt:413 */
          41  +
                    } /* JsonParserGenerator.kt:409 */
   25     42   
                }
          43  +
                /* JsonParserGenerator.kt:408 */
   26     44   
            }
   27         -
            }
          45  +
            /* JsonParserGenerator.kt:446 */
   28     46   
            Ok(Some(items))
          47  +
            /* JsonParserGenerator.kt:713 */
   29     48   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
        /* JsonParserGenerator.kt:722 */
          50  +
        _ => {
          51  +
            /* JsonParserGenerator.kt:723 */
          52  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     53   
                "expected start array or null",
   32         -
        )),
          54  +
            ))
          55  +
            /* JsonParserGenerator.kt:722 */
          56  +
        } /* JsonParserGenerator.kt:712 */
   33     57   
    }
          58  +
    /* JsonParserGenerator.kt:398 */
   34     59   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_string_map.rs

@@ -1,1 +41,68 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:460 */
    2      3   
pub(crate) fn de_string_map<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<
    5      6   
    Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
>
    8      9   
where
    9     10   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   10     11   
{
          12  +
    /* JsonParserGenerator.kt:712 */
   11     13   
    match tokens.next().transpose()? {
   12         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          14  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   13     15   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          16  +
            /* JsonParserGenerator.kt:469 */
   14     17   
            let mut map = ::std::collections::HashMap::new();
          18  +
            /* JsonParserGenerator.kt:684 */
   15     19   
            loop {
          20  +
                /* JsonParserGenerator.kt:685 */
   16     21   
                match tokens.next().transpose()? {
   17         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   18     23   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   19         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   20         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   21         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   22         -
                            .transpose()?;
          24  +
                        /* JsonParserGenerator.kt:471 */
          25  +
                        let key =
          26  +
                            /* JsonParserGenerator.kt:339 */key.to_unescaped().map(|u|
          27  +
                                /* JsonParserGenerator.kt:348 */u.into_owned()
          28  +
                            /* JsonParserGenerator.kt:339 */)
          29  +
                        /* JsonParserGenerator.kt:471 */?;
          30  +
                        /* JsonParserGenerator.kt:474 */
          31  +
                        let value =
          32  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          33  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          34  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          35  +
                                /* JsonParserGenerator.kt:339 */)
          36  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          37  +
                        /* JsonParserGenerator.kt:474 */;
          38  +
                        /* JsonParserGenerator.kt:491 */
   23     39   
                        if let Some(value) = value {
   24     40   
                            map.insert(key, value);
   25     41   
                        }
          42  +
                        /* JsonParserGenerator.kt:686 */
   26     43   
                    }
          44  +
                    /* JsonParserGenerator.kt:695 */
   27     45   
                    other => {
   28     46   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   29     47   
                            "expected object key or end object, found: {:?}",
   30     48   
                            other
   31     49   
                        )))
          50  +
                    } /* JsonParserGenerator.kt:685 */
   32     51   
                }
          52  +
                /* JsonParserGenerator.kt:684 */
   33     53   
            }
   34         -
            }
          54  +
            /* JsonParserGenerator.kt:504 */
   35     55   
            Ok(Some(map))
          56  +
            /* JsonParserGenerator.kt:713 */
   36     57   
        }
   37         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          58  +
        /* JsonParserGenerator.kt:722 */
          59  +
        _ => {
          60  +
            /* JsonParserGenerator.kt:723 */
          61  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   38     62   
                "expected start object or null",
   39         -
        )),
          63  +
            ))
          64  +
            /* JsonParserGenerator.kt:722 */
          65  +
        } /* JsonParserGenerator.kt:712 */
   40     66   
    }
          67  +
    /* JsonParserGenerator.kt:460 */
   41     68   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_string_set.rs

@@ -1,1 +34,59 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_string_set<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<::std::string::String>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   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()?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:354 */::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s|
          31  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          32  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          33  +
                                /* JsonParserGenerator.kt:339 */)
          34  +
                            /* JsonParserGenerator.kt:354 */).transpose()?
          35  +
                        /* JsonParserGenerator.kt:419 */;
          36  +
                        /* JsonParserGenerator.kt:422 */
   22     37   
                        if let Some(value) = value {
   23     38   
                            items.push(value);
   24     39   
                        }
          40  +
                        /* JsonParserGenerator.kt:413 */
          41  +
                    } /* JsonParserGenerator.kt:409 */
   25     42   
                }
          43  +
                /* JsonParserGenerator.kt:408 */
   26     44   
            }
   27         -
            }
          45  +
            /* JsonParserGenerator.kt:446 */
   28     46   
            Ok(Some(items))
          47  +
            /* JsonParserGenerator.kt:713 */
   29     48   
        }
   30         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          49  +
        /* JsonParserGenerator.kt:722 */
          50  +
        _ => {
          51  +
            /* JsonParserGenerator.kt:723 */
          52  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31     53   
                "expected start array or null",
   32         -
        )),
          54  +
            ))
          55  +
            /* JsonParserGenerator.kt:722 */
          56  +
        } /* JsonParserGenerator.kt:712 */
   33     57   
    }
          58  +
    /* JsonParserGenerator.kt:398 */
   34     59   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_structure_list.rs

@@ -1,1 +32,55 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:398 */
    2      3   
pub(crate) fn de_structure_list<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::StructureListMember>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
          13  +
            /* JsonParserGenerator.kt:407 */
   11     14   
            let mut items = Vec::new();
          15  +
            /* JsonParserGenerator.kt:408 */
   12     16   
            loop {
          17  +
                /* JsonParserGenerator.kt:409 */
   13     18   
                match tokens.peek() {
          19  +
                    /* JsonParserGenerator.kt:410 */
   14     20   
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
          21  +
                        /* JsonParserGenerator.kt:411 */
   15     22   
                        tokens.next().transpose().unwrap();
   16     23   
                        break;
          24  +
                        /* JsonParserGenerator.kt:410 */
   17     25   
                    }
          26  +
                    /* JsonParserGenerator.kt:413 */
   18     27   
                    _ => {
   19         -
                        let value = crate::protocol_serde::shape_structure_list_member::de_structure_list_member(tokens)?;
          28  +
                        /* JsonParserGenerator.kt:419 */
          29  +
                        let value =
          30  +
                            /* JsonParserGenerator.kt:544 */crate::protocol_serde::shape_structure_list_member::de_structure_list_member(tokens)?
          31  +
                        /* JsonParserGenerator.kt:419 */;
          32  +
                        /* JsonParserGenerator.kt:422 */
   20     33   
                        if let Some(value) = value {
   21     34   
                            items.push(value);
   22     35   
                        }
          36  +
                        /* JsonParserGenerator.kt:413 */
          37  +
                    } /* JsonParserGenerator.kt:409 */
   23     38   
                }
          39  +
                /* JsonParserGenerator.kt:408 */
   24     40   
            }
   25         -
            }
          41  +
            /* JsonParserGenerator.kt:446 */
   26     42   
            Ok(Some(items))
          43  +
            /* JsonParserGenerator.kt:713 */
   27     44   
        }
   28         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          45  +
        /* JsonParserGenerator.kt:722 */
          46  +
        _ => {
          47  +
            /* JsonParserGenerator.kt:723 */
          48  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   29     49   
                "expected start array or null",
   30         -
        )),
          50  +
            ))
          51  +
            /* JsonParserGenerator.kt:722 */
          52  +
        } /* JsonParserGenerator.kt:712 */
   31     53   
    }
          54  +
    /* JsonParserGenerator.kt:398 */
   32     55   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_structure_list_member.rs

@@ -1,1 +60,104 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_structure_list_member(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::types::StructureListMember,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.a {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("value").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:382 */
    9     14   
    if let Some(var_2) = &input.b {
          15  +
        /* JsonSerializerGenerator.kt:423 */
   10     16   
        object.key("other").string(var_2.as_str());
          17  +
        /* JsonSerializerGenerator.kt:382 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
   12     20   
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
   13     22   
}
   14     23   
          24  +
/* JsonParserGenerator.kt:516 */
   15     25   
pub(crate) fn de_structure_list_member<'a, I>(
   16     26   
    tokens: &mut ::std::iter::Peekable<I>,
   17     27   
) -> ::std::result::Result<Option<crate::types::StructureListMember>, ::aws_smithy_json::deserialize::error::DeserializeError>
   18     28   
where
   19     29   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   20     30   
{
          31  +
    /* JsonParserGenerator.kt:712 */
   21     32   
    match tokens.next().transpose()? {
   22         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          33  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   23     34   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          35  +
            /* RustType.kt:516 */
   24     36   
            #[allow(unused_mut)]
          37  +
            /* JsonParserGenerator.kt:526 */
   25     38   
            let mut builder = crate::types::builders::StructureListMemberBuilder::default();
          39  +
            /* JsonParserGenerator.kt:684 */
   26     40   
            loop {
          41  +
                /* JsonParserGenerator.kt:685 */
   27     42   
                match tokens.next().transpose()? {
   28         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   29         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          43  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          44  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          45  +
                        /* JsonParserGenerator.kt:260 */
          46  +
                        match key.to_unescaped()?.as_ref() {
          47  +
                            /* JsonParserGenerator.kt:262 */
   30     48   
                            "value" => {
          49  +
                                /* JsonParserGenerator.kt:265 */
   31     50   
                                builder = builder.set_a(
          51  +
                                    /* JsonParserGenerator.kt:354 */
   32     52   
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   33         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   34         -
                                    .transpose()?,
          53  +
                                        .map(|s|
          54  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          55  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          56  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          57  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
   35     58   
                                );
          59  +
                                /* JsonParserGenerator.kt:262 */
   36     60   
                            }
          61  +
                            /* JsonParserGenerator.kt:262 */
   37     62   
                            "other" => {
          63  +
                                /* JsonParserGenerator.kt:265 */
   38     64   
                                builder = builder.set_b(
          65  +
                                    /* JsonParserGenerator.kt:354 */
   39     66   
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   40         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   41         -
                                    .transpose()?,
          67  +
                                        .map(|s|
          68  +
                                        /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          69  +
                                            /* JsonParserGenerator.kt:348 */u.into_owned()
          70  +
                                        /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          71  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
   42     72   
                                );
          73  +
                                /* JsonParserGenerator.kt:262 */
   43     74   
                            }
   44         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   45         -
                    },
          75  +
                            /* JsonParserGenerator.kt:290 */
          76  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          77  +
                        }
          78  +
                        /* JsonParserGenerator.kt:686 */
          79  +
                    }
          80  +
                    /* JsonParserGenerator.kt:695 */
   46     81   
                    other => {
   47     82   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   48     83   
                            "expected object key or end object, found: {:?}",
   49     84   
                            other
   50     85   
                        )))
          86  +
                    } /* JsonParserGenerator.kt:685 */
   51     87   
                }
          88  +
                /* JsonParserGenerator.kt:684 */
   52     89   
            }
   53         -
            }
          90  +
            /* JsonParserGenerator.kt:540 */
   54     91   
            Ok(Some(builder.build()))
          92  +
            /* JsonParserGenerator.kt:713 */
   55     93   
        }
   56         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          94  +
        /* JsonParserGenerator.kt:722 */
          95  +
        _ => {
          96  +
            /* JsonParserGenerator.kt:723 */
          97  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   57     98   
                "expected start object or null",
   58         -
        )),
          99  +
            ))
         100  +
            /* JsonParserGenerator.kt:722 */
         101  +
        } /* JsonParserGenerator.kt:712 */
   59    102   
    }
         103  +
    /* JsonParserGenerator.kt:516 */
   60    104   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_body_structure.rs

@@ -1,1 +98,152 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_body_structure_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
    8     10   
{
          11  +
    /* RustType.kt:516 */
    9     12   
    #[allow(unused_mut)]
          13  +
    /* ProtocolParserGenerator.kt:106 */
   10     14   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11     15   
        .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
          16  +
    /* ProtocolParserGenerator.kt:120 */
   12     17   
    let generic = generic_builder.build();
          18  +
    /* ProtocolParserGenerator.kt:185 */
   13     19   
    Err(crate::operation::test_body_structure::TestBodyStructureError::generic(generic))
          20  +
    /* ProtocolParserGenerator.kt:99 */
   14     21   
}
   15     22   
          23  +
/* RustType.kt:516 */
   16     24   
#[allow(clippy::unnecessary_wraps)]
          25  +
/* ProtocolParserGenerator.kt:71 */
   17     26   
pub fn de_test_body_structure_http_response(
   18     27   
    _response_status: u16,
   19     28   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20     29   
    _response_body: &[u8],
   21     30   
) -> std::result::Result<crate::operation::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
   22     31   
{
          32  +
    /* ProtocolParserGenerator.kt:77 */
   23     33   
    Ok({
          34  +
        /* RustType.kt:516 */
   24     35   
        #[allow(unused_mut)]
          36  +
        /* ProtocolParserGenerator.kt:240 */
   25     37   
        let mut output = crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder::default();
          38  +
        /* ProtocolParserGenerator.kt:247 */
   26     39   
        output = crate::protocol_serde::shape_test_body_structure::de_test_body_structure(_response_body, output)
   27     40   
            .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
          41  +
        /* ProtocolParserGenerator.kt:267 */
   28     42   
        output = output.set_test_id(
          43  +
            /* ProtocolParserGenerator.kt:302 */
   29     44   
            crate::protocol_serde::shape_test_body_structure_output::de_test_id_header(_response_headers).map_err(|_| {
   30     45   
                crate::operation::test_body_structure::TestBodyStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
   31         -
            })?,
          46  +
            })?, /* ProtocolParserGenerator.kt:267 */
   32     47   
        );
          48  +
        /* ClientBuilderInstantiator.kt:56 */
   33     49   
        output.build()
          50  +
        /* ProtocolParserGenerator.kt:77 */
   34     51   
    })
          52  +
    /* ProtocolParserGenerator.kt:71 */
   35     53   
}
   36     54   
          55  +
/* HttpBindingGenerator.kt:542 */
   37     56   
pub fn ser_test_body_structure_headers(
   38     57   
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   39     58   
    mut builder: ::http::request::Builder,
   40     59   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          60  +
    /* HttpBindingGenerator.kt:592 */
   41     61   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          62  +
        /* HttpBindingGenerator.kt:704 */
   42     63   
        let formatted_2 = inner_1.as_str();
          64  +
        /* HttpBindingGenerator.kt:706 */
   43     65   
        let header_value = formatted_2;
   44     66   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   45     67   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   46     68   
                "test_id",
   47     69   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   48     70   
            )
   49     71   
        })?;
   50     72   
        builder = builder.header("x-amz-test-id", header_value);
          73  +
        /* HttpBindingGenerator.kt:592 */
   51     74   
    }
          75  +
    /* HttpBindingGenerator.kt:555 */
   52     76   
    Ok(builder)
          77  +
    /* HttpBindingGenerator.kt:542 */
   53     78   
}
   54     79   
          80  +
/* JsonSerializerGenerator.kt:287 */
   55     81   
pub fn ser_test_body_structure_input(
   56     82   
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   57     83   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          84  +
    /* JsonSerializerGenerator.kt:291 */
   58     85   
    let mut out = String::new();
          86  +
    /* JsonSerializerGenerator.kt:292 */
   59     87   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          88  +
    /* JsonSerializerGenerator.kt:375 */
   60     89   
    crate::protocol_serde::shape_test_body_structure_input::ser_test_body_structure_input_input(&mut object, input)?;
          90  +
    /* JsonSerializerGenerator.kt:295 */
   61     91   
    object.finish();
          92  +
    /* JsonSerializerGenerator.kt:296 */
   62     93   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          94  +
    /* JsonSerializerGenerator.kt:287 */
   63     95   
}
   64     96   
          97  +
/* JsonParserGenerator.kt:148 */
   65     98   
pub(crate) fn de_test_body_structure(
   66     99   
    value: &[u8],
   67    100   
    mut builder: crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
   68    101   
) -> ::std::result::Result<
   69    102   
    crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
   70    103   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   71    104   
> {
         105  +
    /* JsonParserGenerator.kt:153 */
   72    106   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   73    107   
    let tokens = &mut tokens_owned;
   74    108   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         109  +
    /* JsonParserGenerator.kt:684 */
   75    110   
    loop {
         111  +
        /* JsonParserGenerator.kt:685 */
   76    112   
        match tokens.next().transpose()? {
   77         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   78         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
         113  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
         114  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         115  +
                /* JsonParserGenerator.kt:260 */
         116  +
                match key.to_unescaped()?.as_ref() {
         117  +
                    /* JsonParserGenerator.kt:262 */
   79    118   
                    "testConfig" => {
   80         -
                    builder = builder.set_test_config(crate::protocol_serde::shape_test_config::de_test_config(tokens)?);
         119  +
                        /* JsonParserGenerator.kt:265 */
         120  +
                        builder = builder.set_test_config(
         121  +
                            /* JsonParserGenerator.kt:544 */
         122  +
                            crate::protocol_serde::shape_test_config::de_test_config(tokens)?, /* JsonParserGenerator.kt:265 */
         123  +
                        );
         124  +
                        /* JsonParserGenerator.kt:262 */
         125  +
                    }
         126  +
                    /* JsonParserGenerator.kt:290 */
         127  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   81    128   
                }
   82         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   83         -
            },
         129  +
                /* JsonParserGenerator.kt:686 */
         130  +
            }
         131  +
            /* JsonParserGenerator.kt:695 */
   84    132   
            other => {
   85    133   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   86    134   
                    "expected object key or end object, found: {:?}",
   87    135   
                    other
   88    136   
                )))
         137  +
            } /* JsonParserGenerator.kt:685 */
   89    138   
        }
         139  +
        /* JsonParserGenerator.kt:684 */
   90    140   
    }
   91         -
    }
         141  +
    /* JsonParserGenerator.kt:250 */
   92    142   
    if tokens.next().is_some() {
         143  +
        /* JsonParserGenerator.kt:251 */
   93    144   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   94    145   
            "found more JSON tokens after completing parsing",
   95    146   
        ));
         147  +
        /* JsonParserGenerator.kt:250 */
   96    148   
    }
         149  +
    /* JsonParserGenerator.kt:163 */
   97    150   
    Ok(builder)
         151  +
    /* JsonParserGenerator.kt:148 */
   98    152   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_body_structure_input.rs

@@ -1,1 +13,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_test_body_structure_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.test_config {
           9  +
        /* JsonSerializerGenerator.kt:495 */
    7     10   
        #[allow(unused_mut)]
          11  +
        /* JsonSerializerGenerator.kt:496 */
    8     12   
        let mut object_2 = object.key("testConfig").start_object();
          13  +
        /* JsonSerializerGenerator.kt:375 */
    9     14   
        crate::protocol_serde::shape_test_config::ser_test_config(&mut object_2, var_1)?;
          15  +
        /* JsonSerializerGenerator.kt:515 */
   10     16   
        object_2.finish();
          17  +
        /* JsonSerializerGenerator.kt:382 */
   11     18   
    }
          19  +
    /* JsonSerializerGenerator.kt:372 */
   12     20   
    Ok(())
          21  +
    /* JsonSerializerGenerator.kt:358 */
   13     22   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_body_structure_output.rs

@@ -1,1 +7,11 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("x-amz-test-id");
           8  +
    /* HttpBindingGenerator.kt:375 */
    6      9   
    ::aws_smithy_http::header::one_or_none(headers)
          10  +
    /* HttpBindingGenerator.kt:153 */
    7     11   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_config.rs

@@ -1,1 +53,84 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonParserGenerator.kt:516 */
    2      3   
pub(crate) fn de_test_config<'a, I>(
    3      4   
    tokens: &mut ::std::iter::Peekable<I>,
    4      5   
) -> ::std::result::Result<Option<crate::types::TestConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5      6   
where
    6      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7      8   
{
           9  +
    /* JsonParserGenerator.kt:712 */
    8     10   
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          11  +
        /* JsonParserGenerator.kt:713 */ Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10     12   
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          13  +
            /* RustType.kt:516 */
   11     14   
            #[allow(unused_mut)]
          15  +
            /* JsonParserGenerator.kt:526 */
   12     16   
            let mut builder = crate::types::builders::TestConfigBuilder::default();
          17  +
            /* JsonParserGenerator.kt:684 */
   13     18   
            loop {
          19  +
                /* JsonParserGenerator.kt:685 */
   14     20   
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          21  +
                    /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          22  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          23  +
                        /* JsonParserGenerator.kt:260 */
          24  +
                        match key.to_unescaped()?.as_ref() {
          25  +
                            /* JsonParserGenerator.kt:262 */
   17     26   
                            "timeout" => {
          27  +
                                /* JsonParserGenerator.kt:265 */
   18     28   
                                builder = builder.set_timeout(
          29  +
                                    /* JsonParserGenerator.kt:365 */
   19     30   
                                    ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
   20     31   
                                        .map(i32::try_from)
   21         -
                                    .transpose()?,
          32  +
                                        .transpose()?, /* JsonParserGenerator.kt:265 */
   22     33   
                                );
          34  +
                                /* JsonParserGenerator.kt:262 */
   23     35   
                            }
   24         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   25         -
                    },
          36  +
                            /* JsonParserGenerator.kt:290 */
          37  +
                            _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
          38  +
                        }
          39  +
                        /* JsonParserGenerator.kt:686 */
          40  +
                    }
          41  +
                    /* JsonParserGenerator.kt:695 */
   26     42   
                    other => {
   27     43   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   28     44   
                            "expected object key or end object, found: {:?}",
   29     45   
                            other
   30     46   
                        )))
          47  +
                    } /* JsonParserGenerator.kt:685 */
   31     48   
                }
          49  +
                /* JsonParserGenerator.kt:684 */
   32     50   
            }
   33         -
            }
          51  +
            /* JsonParserGenerator.kt:540 */
   34     52   
            Ok(Some(builder.build()))
          53  +
            /* JsonParserGenerator.kt:713 */
   35     54   
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          55  +
        /* JsonParserGenerator.kt:722 */
          56  +
        _ => {
          57  +
            /* JsonParserGenerator.kt:723 */
          58  +
            Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37     59   
                "expected start object or null",
   38         -
        )),
          60  +
            ))
          61  +
            /* JsonParserGenerator.kt:722 */
          62  +
        } /* JsonParserGenerator.kt:712 */
   39     63   
    }
          64  +
    /* JsonParserGenerator.kt:516 */
   40     65   
}
   41     66   
          67  +
/* JsonSerializerGenerator.kt:358 */
   42     68   
pub fn ser_test_config(
   43     69   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   44     70   
    input: &crate::types::TestConfig,
   45     71   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          72  +
    /* JsonSerializerGenerator.kt:382 */
   46     73   
    if let Some(var_1) = &input.timeout {
          74  +
        /* JsonSerializerGenerator.kt:432 */
   47     75   
        object.key("timeout").number(
   48     76   
            #[allow(clippy::useless_conversion)]
   49     77   
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
   50     78   
        );
          79  +
        /* JsonSerializerGenerator.kt:382 */
   51     80   
    }
          81  +
    /* JsonSerializerGenerator.kt:372 */
   52     82   
    Ok(())
          83  +
    /* JsonSerializerGenerator.kt:358 */
   53     84   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_get_no_input_no_payload.rs

@@ -1,1 +41,58 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_get_no_input_no_payload_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<
    8     10   
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadOutput,
    9     11   
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError,
   10     12   
> {
          13  +
    /* RustType.kt:516 */
   11     14   
    #[allow(unused_mut)]
          15  +
    /* ProtocolParserGenerator.kt:106 */
   12     16   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13     17   
        .map_err(crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError::generic(
   16     22   
        generic,
   17     23   
    ))
          24  +
    /* ProtocolParserGenerator.kt:99 */
   18     25   
}
   19     26   
          27  +
/* RustType.kt:516 */
   20     28   
#[allow(clippy::unnecessary_wraps)]
          29  +
/* ProtocolParserGenerator.kt:71 */
   21     30   
pub fn de_test_get_no_input_no_payload_http_response(
   22     31   
    _response_status: u16,
   23     32   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24     33   
    _response_body: &[u8],
   25     34   
) -> std::result::Result<
   26     35   
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadOutput,
   27     36   
    crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError,
   28     37   
> {
          38  +
    /* ProtocolParserGenerator.kt:77 */
   29     39   
    Ok({
          40  +
        /* RustType.kt:516 */
   30     41   
        #[allow(unused_mut)]
          42  +
        /* ProtocolParserGenerator.kt:240 */
   31     43   
        let mut output = crate::operation::test_get_no_input_no_payload::builders::TestGetNoInputNoPayloadOutputBuilder::default();
          44  +
        /* ProtocolParserGenerator.kt:267 */
   32     45   
        output = output.set_test_id(
          46  +
            /* ProtocolParserGenerator.kt:302 */
   33     47   
            crate::protocol_serde::shape_test_get_no_input_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   34     48   
                crate::operation::test_get_no_input_no_payload::TestGetNoInputNoPayloadError::unhandled(
   35     49   
                    "Failed to parse testId from header `X-Amz-Test-Id",
   36     50   
                )
   37         -
            })?,
          51  +
            })?, /* ProtocolParserGenerator.kt:267 */
   38     52   
        );
          53  +
        /* ClientBuilderInstantiator.kt:56 */
   39     54   
        output.build()
          55  +
        /* ProtocolParserGenerator.kt:77 */
   40     56   
    })
          57  +
    /* ProtocolParserGenerator.kt:71 */
   41     58   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_get_no_input_no_payload_output.rs

@@ -1,1 +7,11 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_test_id_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
           6  +
    /* HttpBindingGenerator.kt:160 */
    5      7   
    let headers = header_map.get_all("X-Amz-Test-Id");
           8  +
    /* HttpBindingGenerator.kt:375 */
    6      9   
    ::aws_smithy_http::header::one_or_none(headers)
          10  +
    /* HttpBindingGenerator.kt:153 */
    7     11   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_test_get_no_payload.rs

@@ -1,1 +51,75 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ProtocolParserGenerator.kt:99 */
    3      5   
pub fn de_test_get_no_payload_http_error(
    4      6   
    _response_status: u16,
    5      7   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6      8   
    _response_body: &[u8],
    7      9   
) -> std::result::Result<crate::operation::test_get_no_payload::TestGetNoPayloadOutput, crate::operation::test_get_no_payload::TestGetNoPayloadError>
    8     10   
{
          11  +
    /* RustType.kt:516 */
    9     12   
    #[allow(unused_mut)]
          13  +
    /* ProtocolParserGenerator.kt:106 */
   10     14   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   11     15   
        .map_err(crate::operation::test_get_no_payload::TestGetNoPayloadError::unhandled)?;
          16  +
    /* ProtocolParserGenerator.kt:120 */
   12     17   
    let generic = generic_builder.build();
          18  +
    /* ProtocolParserGenerator.kt:185 */
   13     19   
    Err(crate::operation::test_get_no_payload::TestGetNoPayloadError::generic(generic))
          20  +
    /* ProtocolParserGenerator.kt:99 */
   14     21   
}
   15     22   
          23  +
/* RustType.kt:516 */
   16     24   
#[allow(clippy::unnecessary_wraps)]
          25  +
/* ProtocolParserGenerator.kt:71 */
   17     26   
pub fn de_test_get_no_payload_http_response(
   18     27   
    _response_status: u16,
   19     28   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   20     29   
    _response_body: &[u8],
   21     30   
) -> std::result::Result<crate::operation::test_get_no_payload::TestGetNoPayloadOutput, crate::operation::test_get_no_payload::TestGetNoPayloadError>
   22     31   
{
          32  +
    /* ProtocolParserGenerator.kt:77 */
   23     33   
    Ok({
          34  +
        /* RustType.kt:516 */
   24     35   
        #[allow(unused_mut)]
          36  +
        /* ProtocolParserGenerator.kt:240 */
   25     37   
        let mut output = crate::operation::test_get_no_payload::builders::TestGetNoPayloadOutputBuilder::default();
          38  +
        /* ProtocolParserGenerator.kt:267 */
   26     39   
        output = output.set_test_id(
          40  +
            /* ProtocolParserGenerator.kt:302 */
   27     41   
            crate::protocol_serde::shape_test_get_no_payload_output::de_test_id_header(_response_headers).map_err(|_| {
   28     42   
                crate::operation::test_get_no_payload::TestGetNoPayloadError::unhandled("Failed to parse testId from header `X-Amz-Test-Id")
   29         -
            })?,
          43  +
            })?, /* ProtocolParserGenerator.kt:267 */
   30     44   
        );
          45  +
        /* ClientBuilderInstantiator.kt:56 */
   31     46   
        output.build()
          47  +
        /* ProtocolParserGenerator.kt:77 */
   32     48   
    })
          49  +
    /* ProtocolParserGenerator.kt:71 */
   33     50   
}
   34     51   
          52  +
/* HttpBindingGenerator.kt:542 */
   35     53   
pub fn ser_test_get_no_payload_headers(
   36     54   
    input: &crate::operation::test_get_no_payload::TestGetNoPayloadInput,
   37     55   
    mut builder: ::http::request::Builder,
   38     56   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          57  +
    /* HttpBindingGenerator.kt:592 */
   39     58   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
          59  +
        /* HttpBindingGenerator.kt:704 */
   40     60   
        let formatted_2 = inner_1.as_str();
          61  +
        /* HttpBindingGenerator.kt:706 */
   41     62   
        let header_value = formatted_2;
   42     63   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   43     64   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   44     65   
                "test_id",
   45     66   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46     67   
            )
   47     68   
        })?;
   48     69   
        builder = builder.header("X-Amz-Test-Id", header_value);
          70  +
        /* HttpBindingGenerator.kt:592 */
   49     71   
    }
          72  +
    /* HttpBindingGenerator.kt:555 */
   50     73   
    Ok(builder)
          74  +
    /* HttpBindingGenerator.kt:542 */
   51     75   
}