Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943

Files changed:

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

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

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

@@ -1,1 +95,131 @@
    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_greeting_with_errors_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::greeting_with_errors::GreetingWithErrorsOutput,
    9     11   
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   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::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:122 */
   15     21   
    let error_code = match generic.code() {
   16     22   
        Some(code) => code,
   17     23   
        None => return Err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled(generic)),
   18     24   
    };
   19     25   
   20     26   
    let _error_message = generic.message().map(|msg| msg.to_owned());
          27  +
    /* ProtocolParserGenerator.kt:133 */
   21     28   
    Err(match error_code {
          29  +
        /* ProtocolParserGenerator.kt:139 */
   22     30   
        "InvalidGreeting" => crate::operation::greeting_with_errors::GreetingWithErrorsError::InvalidGreeting({
          31  +
            /* RustType.kt:516 */
   23     32   
            #[allow(unused_mut)]
   24         -
            let mut tmp = {
   25         -
                #[allow(unused_mut)]
   26         -
                let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
   27         -
                output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output)
   28         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   29         -
                let output = output.meta(generic);
   30         -
                output.build()
   31         -
            };
          33  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          34  +
                /* ProtocolParserGenerator.kt:146 */ {
          35  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          36  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::InvalidGreetingBuilder::default();
          37  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_invalid_greeting::de_invalid_greeting_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          38  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          39  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          40  +
                /* ProtocolParserGenerator.kt:146 */}
          41  +
            /* ProtocolParserGenerator.kt:145 */;
          42  +
            /* ProtocolParserGenerator.kt:170 */
   32     43   
            if tmp.message.is_none() {
   33     44   
                tmp.message = _error_message;
   34     45   
            }
          46  +
            /* ProtocolParserGenerator.kt:179 */
   35     47   
            tmp
          48  +
            /* ProtocolParserGenerator.kt:139 */
   36     49   
        }),
          50  +
        /* ProtocolParserGenerator.kt:139 */
   37     51   
        "ComplexError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::ComplexError({
          52  +
            /* RustType.kt:516 */
   38     53   
            #[allow(unused_mut)]
   39         -
            let mut tmp = {
   40         -
                #[allow(unused_mut)]
   41         -
                let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
   42         -
                output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output)
   43         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   44         -
                output = output.set_header(
   45         -
                    crate::protocol_serde::shape_complex_error::de_header_header(_response_headers).map_err(|_| {
   46         -
                        crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled("Failed to parse Header from header `X-Header")
   47         -
                    })?,
   48         -
                );
   49         -
                let output = output.meta(generic);
   50         -
                output.build()
   51         -
            };
          54  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          55  +
                /* ProtocolParserGenerator.kt:146 */ {
          56  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          57  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::ComplexErrorBuilder::default();
          58  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_complex_error::de_complex_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          59  +
                    /* ProtocolParserGenerator.kt:267 */output = output.set_header(
          60  +
                        /* ProtocolParserGenerator.kt:302 */crate::protocol_serde::shape_complex_error::de_header_header(_response_headers)
          61  +
                                                    .map_err(|_|crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled("Failed to parse Header from header `X-Header"))?
          62  +
                    /* ProtocolParserGenerator.kt:267 */);
          63  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          64  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          65  +
                /* ProtocolParserGenerator.kt:146 */}
          66  +
            /* ProtocolParserGenerator.kt:145 */;
          67  +
            /* ProtocolParserGenerator.kt:170 */
   52     68   
            if tmp.message.is_none() {
   53     69   
                tmp.message = _error_message;
   54     70   
            }
          71  +
            /* ProtocolParserGenerator.kt:179 */
   55     72   
            tmp
          73  +
            /* ProtocolParserGenerator.kt:139 */
   56     74   
        }),
          75  +
        /* ProtocolParserGenerator.kt:139 */
   57     76   
        "FooError" => crate::operation::greeting_with_errors::GreetingWithErrorsError::FooError({
          77  +
            /* RustType.kt:516 */
   58     78   
            #[allow(unused_mut)]
   59         -
            let mut tmp = {
   60         -
                #[allow(unused_mut)]
   61         -
                let mut output = crate::types::error::builders::FooErrorBuilder::default();
   62         -
                output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output)
   63         -
                    .map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
   64         -
                let output = output.meta(generic);
   65         -
                output.build()
   66         -
            };
          79  +
            /* ProtocolParserGenerator.kt:145 */let mut tmp =
          80  +
                /* ProtocolParserGenerator.kt:146 */ {
          81  +
                    /* RustType.kt:516 */#[allow(unused_mut)]
          82  +
                    /* ProtocolParserGenerator.kt:240 */let mut output = crate::types::error::builders::FooErrorBuilder::default();
          83  +
                    /* ProtocolParserGenerator.kt:257 */output = crate::protocol_serde::shape_foo_error::de_foo_error_json_err(_response_body, output).map_err(crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled)?;
          84  +
                    /* ProtocolParserGenerator.kt:157 */let output = output.meta(generic);
          85  +
                    /* ClientBuilderInstantiator.kt:56 */output.build()
          86  +
                /* ProtocolParserGenerator.kt:146 */}
          87  +
            /* ProtocolParserGenerator.kt:145 */;
          88  +
            /* ProtocolParserGenerator.kt:170 */
   67     89   
            if tmp.message.is_none() {
   68     90   
                tmp.message = _error_message;
   69     91   
            }
          92  +
            /* ProtocolParserGenerator.kt:179 */
   70     93   
            tmp
          94  +
            /* ProtocolParserGenerator.kt:139 */
   71     95   
        }),
   72         -
        _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic),
          96  +
        /* ProtocolParserGenerator.kt:182 */
          97  +
        _ => crate::operation::greeting_with_errors::GreetingWithErrorsError::generic(generic), /* ProtocolParserGenerator.kt:133 */
   73     98   
    })
          99  +
    /* ProtocolParserGenerator.kt:99 */
   74    100   
}
   75    101   
         102  +
/* RustType.kt:516 */
   76    103   
#[allow(clippy::unnecessary_wraps)]
         104  +
/* ProtocolParserGenerator.kt:71 */
   77    105   
pub fn de_greeting_with_errors_http_response(
   78    106   
    _response_status: u16,
   79    107   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   80    108   
    _response_body: &[u8],
   81    109   
) -> std::result::Result<
   82    110   
    crate::operation::greeting_with_errors::GreetingWithErrorsOutput,
   83    111   
    crate::operation::greeting_with_errors::GreetingWithErrorsError,
   84    112   
> {
         113  +
    /* ProtocolParserGenerator.kt:77 */
   85    114   
    Ok({
         115  +
        /* RustType.kt:516 */
   86    116   
        #[allow(unused_mut)]
         117  +
        /* ProtocolParserGenerator.kt:240 */
   87    118   
        let mut output = crate::operation::greeting_with_errors::builders::GreetingWithErrorsOutputBuilder::default();
         119  +
        /* ProtocolParserGenerator.kt:267 */
   88    120   
        output = output.set_greeting(
         121  +
            /* ProtocolParserGenerator.kt:302 */
   89    122   
            crate::protocol_serde::shape_greeting_with_errors_output::de_greeting_header(_response_headers).map_err(|_| {
   90    123   
                crate::operation::greeting_with_errors::GreetingWithErrorsError::unhandled("Failed to parse greeting from header `X-Greeting")
   91         -
            })?,
         124  +
            })?, /* ProtocolParserGenerator.kt:267 */
   92    125   
        );
         126  +
        /* ClientBuilderInstantiator.kt:56 */
   93    127   
        output.build()
         128  +
        /* ProtocolParserGenerator.kt:77 */
   94    129   
    })
         130  +
    /* ProtocolParserGenerator.kt:71 */
   95    131   
}

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_greeting_with_errors_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_greeting_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-Greeting");
           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_host_with_path_operation.rs

@@ -1,1 +32,47 @@
    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_host_with_path_operation_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::host_with_path_operation::HostWithPathOperationOutput,
    9     11   
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   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::host_with_path_operation::HostWithPathOperationError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::host_with_path_operation::HostWithPathOperationError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_host_with_path_operation_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::host_with_path_operation::HostWithPathOperationOutput,
   25     34   
    crate::operation::host_with_path_operation::HostWithPathOperationError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::host_with_path_operation::builders::HostWithPathOperationOutputBuilder::default();
          42  +
        /* ClientBuilderInstantiator.kt:56 */
   30     43   
        output.build()
          44  +
        /* ProtocolParserGenerator.kt:77 */
   31     45   
    })
          46  +
    /* ProtocolParserGenerator.kt:71 */
   32     47   
}

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

@@ -1,1 +83,129 @@
    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_http_checksum_required_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::http_checksum_required::HttpChecksumRequiredOutput,
    9     11   
    crate::operation::http_checksum_required::HttpChecksumRequiredError,
   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::http_checksum_required::HttpChecksumRequiredError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::http_checksum_required::HttpChecksumRequiredError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_http_checksum_required_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::http_checksum_required::HttpChecksumRequiredOutput,
   25     34   
    crate::operation::http_checksum_required::HttpChecksumRequiredError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder::default();
          42  +
        /* ProtocolParserGenerator.kt:247 */
   30     43   
        output = crate::protocol_serde::shape_http_checksum_required::de_http_checksum_required(_response_body, output)
   31     44   
            .map_err(crate::operation::http_checksum_required::HttpChecksumRequiredError::unhandled)?;
          45  +
        /* ClientBuilderInstantiator.kt:56 */
   32     46   
        output.build()
          47  +
        /* ProtocolParserGenerator.kt:77 */
   33     48   
    })
          49  +
    /* ProtocolParserGenerator.kt:71 */
   34     50   
}
   35     51   
          52  +
/* JsonSerializerGenerator.kt:287 */
   36     53   
pub fn ser_http_checksum_required_input(
   37     54   
    input: &crate::operation::http_checksum_required::HttpChecksumRequiredInput,
   38     55   
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
          56  +
    /* JsonSerializerGenerator.kt:291 */
   39     57   
    let mut out = String::new();
          58  +
    /* JsonSerializerGenerator.kt:292 */
   40     59   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
          60  +
    /* JsonSerializerGenerator.kt:375 */
   41     61   
    crate::protocol_serde::shape_http_checksum_required_input::ser_http_checksum_required_input_input(&mut object, input)?;
          62  +
    /* JsonSerializerGenerator.kt:295 */
   42     63   
    object.finish();
          64  +
    /* JsonSerializerGenerator.kt:296 */
   43     65   
    Ok(::aws_smithy_types::body::SdkBody::from(out))
          66  +
    /* JsonSerializerGenerator.kt:287 */
   44     67   
}
   45     68   
          69  +
/* JsonParserGenerator.kt:148 */
   46     70   
pub(crate) fn de_http_checksum_required(
   47     71   
    value: &[u8],
   48     72   
    mut builder: crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder,
   49     73   
) -> ::std::result::Result<
   50     74   
    crate::operation::http_checksum_required::builders::HttpChecksumRequiredOutputBuilder,
   51     75   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   52     76   
> {
          77  +
    /* JsonParserGenerator.kt:153 */
   53     78   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
   54     79   
    let tokens = &mut tokens_owned;
   55     80   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
          81  +
    /* JsonParserGenerator.kt:684 */
   56     82   
    loop {
          83  +
        /* JsonParserGenerator.kt:685 */
   57     84   
        match tokens.next().transpose()? {
   58         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   59         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   60         -
                "foo" => {
   61         -
                    builder = builder.set_foo(
   62         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   63         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   64         -
                            .transpose()?,
   65         -
                    );
          85  +
            /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          86  +
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          87  +
                /* JsonParserGenerator.kt:260 */
          88  +
                match key.to_unescaped()?.as_ref() {
          89  +
                    /* JsonParserGenerator.kt:262 */
          90  +
                    "foo" => {
          91  +
                        /* JsonParserGenerator.kt:265 */
          92  +
                        builder = builder.set_foo(
          93  +
                            /* JsonParserGenerator.kt:354 */
          94  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          95  +
                                .map(|s|
          96  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
          97  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
          98  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
          99  +
                                .transpose()?, /* JsonParserGenerator.kt:265 */
         100  +
                        );
         101  +
                        /* JsonParserGenerator.kt:262 */
         102  +
                    }
         103  +
                    /* JsonParserGenerator.kt:290 */
         104  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   66    105   
                }
   67         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   68         -
            },
         106  +
                /* JsonParserGenerator.kt:686 */
         107  +
            }
         108  +
            /* JsonParserGenerator.kt:695 */
   69    109   
            other => {
   70    110   
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   71    111   
                    "expected object key or end object, found: {:?}",
   72    112   
                    other
   73    113   
                )))
   74         -
            }
         114  +
            } /* JsonParserGenerator.kt:685 */
   75    115   
        }
         116  +
        /* JsonParserGenerator.kt:684 */
   76    117   
    }
         118  +
    /* JsonParserGenerator.kt:250 */
   77    119   
    if tokens.next().is_some() {
         120  +
        /* JsonParserGenerator.kt:251 */
   78    121   
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   79    122   
            "found more JSON tokens after completing parsing",
   80    123   
        ));
         124  +
        /* JsonParserGenerator.kt:250 */
   81    125   
    }
         126  +
    /* JsonParserGenerator.kt:163 */
   82    127   
    Ok(builder)
         128  +
    /* JsonParserGenerator.kt:148 */
   83    129   
}

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

@@ -1,1 +10,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:358 */
    2      3   
pub fn ser_http_checksum_required_input_input(
    3      4   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4      5   
    input: &crate::operation::http_checksum_required::HttpChecksumRequiredInput,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* JsonSerializerGenerator.kt:382 */
    6      8   
    if let Some(var_1) = &input.foo {
           9  +
        /* JsonSerializerGenerator.kt:423 */
    7     10   
        object.key("foo").string(var_1.as_str());
          11  +
        /* JsonSerializerGenerator.kt:382 */
    8     12   
    }
          13  +
    /* JsonSerializerGenerator.kt:372 */
    9     14   
    Ok(())
          15  +
    /* JsonSerializerGenerator.kt:358 */
   10     16   
}

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

@@ -1,1 +27,46 @@
    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_http_enum_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::http_enum_payload::HttpEnumPayloadOutput, crate::operation::http_enum_payload::HttpEnumPayloadError> {
          10  +
    /* RustType.kt:516 */
    8     11   
    #[allow(unused_mut)]
          12  +
    /* ProtocolParserGenerator.kt:106 */
    9     13   
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10     14   
        .map_err(crate::operation::http_enum_payload::HttpEnumPayloadError::unhandled)?;
          15  +
    /* ProtocolParserGenerator.kt:120 */
   11     16   
    let generic = generic_builder.build();
          17  +
    /* ProtocolParserGenerator.kt:185 */
   12     18   
    Err(crate::operation::http_enum_payload::HttpEnumPayloadError::generic(generic))
          19  +
    /* ProtocolParserGenerator.kt:99 */
   13     20   
}
   14     21   
          22  +
/* RustType.kt:516 */
   15     23   
#[allow(clippy::unnecessary_wraps)]
          24  +
/* ProtocolParserGenerator.kt:71 */
   16     25   
pub fn de_http_enum_payload_http_response(
   17     26   
    _response_status: u16,
   18     27   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   19     28   
    _response_body: &[u8],
   20     29   
) -> std::result::Result<crate::operation::http_enum_payload::HttpEnumPayloadOutput, crate::operation::http_enum_payload::HttpEnumPayloadError> {
          30  +
    /* ProtocolParserGenerator.kt:77 */
   21     31   
    Ok({
          32  +
        /* RustType.kt:516 */
   22     33   
        #[allow(unused_mut)]
          34  +
        /* ProtocolParserGenerator.kt:240 */
   23     35   
        let mut output = crate::operation::http_enum_payload::builders::HttpEnumPayloadOutputBuilder::default();
   24         -
        output = output.set_payload(crate::protocol_serde::shape_http_enum_payload_output::de_payload_payload(_response_body)?);
          36  +
        /* ProtocolParserGenerator.kt:267 */
          37  +
        output = output.set_payload(
          38  +
            /* ProtocolParserGenerator.kt:327 */
          39  +
            crate::protocol_serde::shape_http_enum_payload_output::de_payload_payload(_response_body)?, /* ProtocolParserGenerator.kt:267 */
          40  +
        );
          41  +
        /* ClientBuilderInstantiator.kt:56 */
   25     42   
        output.build()
          43  +
        /* ProtocolParserGenerator.kt:77 */
   26     44   
    })
          45  +
    /* ProtocolParserGenerator.kt:71 */
   27     46   
}

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

@@ -1,1 +10,21 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:311 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<crate::types::StringEnum>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */ Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          12  +
            )
          13  +
        }
    8     14   
    };
    9         -
    Ok(payload.as_str().as_bytes().to_vec())
          15  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          16  +
    Ok(
          17  +
        /* HttpBoundProtocolPayloadGenerator.kt:363 */
          18  +
        payload.as_str().as_bytes().to_vec(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          19  +
    )
          20  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     21   
}

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

@@ -1,1 +11,17 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<::std::option::Option<crate::types::StringEnum>, crate::operation::http_enum_payload::HttpEnumPayloadError> {
           6  +
    /* HttpBindingGenerator.kt:319 */
    5      7   
    (!body.is_empty())
    6      8   
        .then(|| {
           9  +
            /* HttpBindingGenerator.kt:325 */
    7     10   
            let body_str = std::str::from_utf8(body).map_err(crate::operation::http_enum_payload::HttpEnumPayloadError::unhandled)?;
          11  +
            /* HttpBindingGenerator.kt:339 */
    8     12   
            Ok(crate::types::StringEnum::from(body_str))
          13  +
            /* HttpBindingGenerator.kt:319 */
    9     14   
        })
   10     15   
        .transpose()
          16  +
    /* HttpBindingGenerator.kt:248 */
   11     17   
}

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

@@ -1,1 +51,81 @@
    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_http_payload_traits_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::http_payload_traits::HttpPayloadTraitsOutput, crate::operation::http_payload_traits::HttpPayloadTraitsError>
    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::http_payload_traits::HttpPayloadTraitsError::unhandled)?;
          16  +
    /* ProtocolParserGenerator.kt:120 */
   12     17   
    let generic = generic_builder.build();
          18  +
    /* ProtocolParserGenerator.kt:185 */
   13     19   
    Err(crate::operation::http_payload_traits::HttpPayloadTraitsError::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_http_payload_traits_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::http_payload_traits::HttpPayloadTraitsOutput, crate::operation::http_payload_traits::HttpPayloadTraitsError>
   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::http_payload_traits::builders::HttpPayloadTraitsOutputBuilder::default();
   26         -
        output = output.set_blob(crate::protocol_serde::shape_http_payload_traits_output::de_blob_payload(_response_body)?);
   27         -
        output = output.set_foo(
   28         -
            crate::protocol_serde::shape_http_payload_traits_output::de_foo_header(_response_headers)
   29         -
                .map_err(|_| crate::operation::http_payload_traits::HttpPayloadTraitsError::unhandled("Failed to parse foo from header `X-Foo"))?,
          38  +
        /* ProtocolParserGenerator.kt:267 */
          39  +
        output = output.set_blob(
          40  +
            /* ProtocolParserGenerator.kt:327 */
          41  +
            crate::protocol_serde::shape_http_payload_traits_output::de_blob_payload(_response_body)?, /* ProtocolParserGenerator.kt:267 */
   30     42   
        );
          43  +
        /* ProtocolParserGenerator.kt:267 */
          44  +
        output =
          45  +
            output.set_foo(
          46  +
                /* ProtocolParserGenerator.kt:302 */
          47  +
                crate::protocol_serde::shape_http_payload_traits_output::de_foo_header(_response_headers).map_err(|_| {
          48  +
                    crate::operation::http_payload_traits::HttpPayloadTraitsError::unhandled("Failed to parse foo from header `X-Foo")
          49  +
                })?, /* ProtocolParserGenerator.kt:267 */
          50  +
            );
          51  +
        /* ClientBuilderInstantiator.kt:56 */
   31     52   
        output.build()
          53  +
        /* ProtocolParserGenerator.kt:77 */
   32     54   
    })
          55  +
    /* ProtocolParserGenerator.kt:71 */
   33     56   
}
   34     57   
          58  +
/* HttpBindingGenerator.kt:542 */
   35     59   
pub fn ser_http_payload_traits_headers(
   36     60   
    input: &crate::operation::http_payload_traits::HttpPayloadTraitsInput,
   37     61   
    mut builder: ::http::request::Builder,
   38     62   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          63  +
    /* HttpBindingGenerator.kt:592 */
   39     64   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
          65  +
        /* HttpBindingGenerator.kt:704 */
   40     66   
        let formatted_2 = inner_1.as_str();
          67  +
        /* HttpBindingGenerator.kt:706 */
   41     68   
        let header_value = formatted_2;
   42     69   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   43     70   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   44     71   
                "foo",
   45     72   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46     73   
            )
   47     74   
        })?;
   48     75   
        builder = builder.header("X-Foo", header_value);
          76  +
        /* HttpBindingGenerator.kt:592 */
   49     77   
    }
          78  +
    /* HttpBindingGenerator.kt:555 */
   50     79   
    Ok(builder)
          80  +
    /* HttpBindingGenerator.kt:542 */
   51     81   
}

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

@@ -1,1 +10,20 @@
    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: ::std::option::Option<::aws_smithy_types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */ Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          12  +
            )
          13  +
        }
    8     14   
    };
    9         -
    Ok(payload.into_inner())
          15  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          16  +
    Ok(
          17  +
        /* HttpBoundProtocolPayloadGenerator.kt:377 */ payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          18  +
    )
          19  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     20   
}

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

@@ -1,1 +13,26 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<::std::option::Option<::aws_smithy_types::Blob>, crate::operation::http_payload_traits::HttpPayloadTraitsError> {
    5         -
    (!body.is_empty()).then(|| Ok(::aws_smithy_types::Blob::new(body))).transpose()
           6  +
    /* HttpBindingGenerator.kt:319 */
           7  +
    (!body.is_empty())
           8  +
        .then(|| {
           9  +
            /* HttpBindingGenerator.kt:349 */
          10  +
            Ok(::aws_smithy_types::Blob::new(body))
          11  +
            /* HttpBindingGenerator.kt:319 */
          12  +
        })
          13  +
        .transpose()
          14  +
    /* HttpBindingGenerator.kt:248 */
    6     15   
}
    7     16   
          17  +
/* HttpBindingGenerator.kt:153 */
    8     18   
pub(crate) fn de_foo_header(
    9     19   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   10     20   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          21  +
    /* HttpBindingGenerator.kt:160 */
   11     22   
    let headers = header_map.get_all("X-Foo");
          23  +
    /* HttpBindingGenerator.kt:375 */
   12     24   
    ::aws_smithy_http::header::one_or_none(headers)
          25  +
    /* HttpBindingGenerator.kt:153 */
   13     26   
}

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

@@ -1,1 +60,85 @@
    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_http_payload_traits_with_media_type_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::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput,
    9     11   
    crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError,
   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::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError::generic(generic))
          22  +
    /* ProtocolParserGenerator.kt:99 */
   16     23   
}
   17     24   
          25  +
/* RustType.kt:516 */
   18     26   
#[allow(clippy::unnecessary_wraps)]
          27  +
/* ProtocolParserGenerator.kt:71 */
   19     28   
pub fn de_http_payload_traits_with_media_type_http_response(
   20     29   
    _response_status: u16,
   21     30   
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   22     31   
    _response_body: &[u8],
   23     32   
) -> std::result::Result<
   24     33   
    crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeOutput,
   25     34   
    crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError,
   26     35   
> {
          36  +
    /* ProtocolParserGenerator.kt:77 */
   27     37   
    Ok({
          38  +
        /* RustType.kt:516 */
   28     39   
        #[allow(unused_mut)]
          40  +
        /* ProtocolParserGenerator.kt:240 */
   29     41   
        let mut output = crate::operation::http_payload_traits_with_media_type::builders::HttpPayloadTraitsWithMediaTypeOutputBuilder::default();
   30         -
        output = output.set_blob(crate::protocol_serde::shape_http_payload_traits_with_media_type_output::de_blob_payload(
   31         -
            _response_body,
   32         -
        )?);
          42  +
        /* ProtocolParserGenerator.kt:267 */
          43  +
        output = output.set_blob(
          44  +
            /* ProtocolParserGenerator.kt:327 */crate::protocol_serde::shape_http_payload_traits_with_media_type_output::de_blob_payload(_response_body)?
          45  +
        /* ProtocolParserGenerator.kt:267 */);
          46  +
        /* ProtocolParserGenerator.kt:267 */
   33     47   
        output = output.set_foo(
          48  +
            /* ProtocolParserGenerator.kt:302 */
   34     49   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_output::de_foo_header(_response_headers).map_err(|_| {
   35     50   
                crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError::unhandled(
   36     51   
                    "Failed to parse foo from header `X-Foo",
   37     52   
                )
   38         -
            })?,
          53  +
            })?, /* ProtocolParserGenerator.kt:267 */
   39     54   
        );
          55  +
        /* ClientBuilderInstantiator.kt:56 */
   40     56   
        output.build()
          57  +
        /* ProtocolParserGenerator.kt:77 */
   41     58   
    })
          59  +
    /* ProtocolParserGenerator.kt:71 */
   42     60   
}
   43     61   
          62  +
/* HttpBindingGenerator.kt:542 */
   44     63   
pub fn ser_http_payload_traits_with_media_type_headers(
   45     64   
    input: &crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput,
   46     65   
    mut builder: ::http::request::Builder,
   47     66   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
          67  +
    /* HttpBindingGenerator.kt:592 */
   48     68   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
          69  +
        /* HttpBindingGenerator.kt:704 */
   49     70   
        let formatted_2 = inner_1.as_str();
          71  +
        /* HttpBindingGenerator.kt:706 */
   50     72   
        let header_value = formatted_2;
   51     73   
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   52     74   
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   53     75   
                "foo",
   54     76   
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   55     77   
            )
   56     78   
        })?;
   57     79   
        builder = builder.header("X-Foo", header_value);
          80  +
        /* HttpBindingGenerator.kt:592 */
   58     81   
    }
          82  +
    /* HttpBindingGenerator.kt:555 */
   59     83   
    Ok(builder)
          84  +
    /* HttpBindingGenerator.kt:542 */
   60     85   
}

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

@@ -1,1 +10,20 @@
    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: ::std::option::Option<::aws_smithy_types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:320 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:332 */ Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:320 */
          12  +
            )
          13  +
        }
    8     14   
    };
    9         -
    Ok(payload.into_inner())
          15  +
    /* HttpBoundProtocolPayloadGenerator.kt:345 */
          16  +
    Ok(
          17  +
        /* HttpBoundProtocolPayloadGenerator.kt:377 */ payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:345 */
          18  +
    )
          19  +
    /* HttpBoundProtocolPayloadGenerator.kt:311 */
   10     20   
}

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

@@ -1,1 +16,29 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:248 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::Blob>,
    6      7   
    crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeError,
    7      8   
> {
    8         -
    (!body.is_empty()).then(|| Ok(::aws_smithy_types::Blob::new(body))).transpose()
           9  +
    /* HttpBindingGenerator.kt:319 */
          10  +
    (!body.is_empty())
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:349 */
          13  +
            Ok(::aws_smithy_types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:319 */
          15  +
        })
          16  +
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:248 */
    9     18   
}
   10     19   
          20  +
/* HttpBindingGenerator.kt:153 */
   11     21   
pub(crate) fn de_foo_header(
   12     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   13     23   
) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          24  +
    /* HttpBindingGenerator.kt:160 */
   14     25   
    let headers = header_map.get_all("X-Foo");
          26  +
    /* HttpBindingGenerator.kt:375 */
   15     27   
    ::aws_smithy_http::header::one_or_none(headers)
          28  +
    /* HttpBindingGenerator.kt:153 */
   16     29   
}

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

@@ -1,1 +37,54 @@
    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_http_payload_with_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<
    8     10   
    crate::operation::http_payload_with_structure::HttpPayloadWithStructureOutput,
    9     11   
    crate::operation::http_payload_with_structure::HttpPayloadWithStructureError,
   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::http_payload_with_structure::HttpPayloadWithStructureError::unhandled)?;
          18  +
    /* ProtocolParserGenerator.kt:120 */
   14     19   
    let generic = generic_builder.build();
          20  +
    /* ProtocolParserGenerator.kt:185 */
   15     21   
    Err(crate::operation::http_payload_with_structure::HttpPayloadWithStructureError::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_http_payload_with_structure_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::http_payload_with_structure::HttpPayloadWithStructureOutput,
   27     36   
    crate::operation::http_payload_with_structure::HttpPayloadWithStructureError,
   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::http_payload_with_structure::builders::HttpPayloadWithStructureOutputBuilder::default();
   32         -
        output = output.set_nested(crate::protocol_serde::shape_http_payload_with_structure_output::de_nested_payload(
   33         -
            _response_body,
   34         -
        )?);
          44  +
        /* ProtocolParserGenerator.kt:267 */
          45  +
        output = output.set_nested(
          46  +
            /* ProtocolParserGenerator.kt:327 */
          47  +
            crate::protocol_serde::shape_http_payload_with_structure_output::de_nested_payload(_response_body)?, /* ProtocolParserGenerator.kt:267 */
          48  +
        );
          49  +
        /* ClientBuilderInstantiator.kt:56 */
   35     50   
        output.build()
          51  +
        /* ProtocolParserGenerator.kt:77 */
   36     52   
    })
          53  +
    /* ProtocolParserGenerator.kt:71 */
   37     54   
}