Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_foo_enum_list.rs

@@ -0,1 +0,54 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_foo_enum_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn member(
           9  +
        mut list: crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained,
          13  +
        ::aws_smithy_cbor::decode::DeserializeError,
          14  +
    > {
          15  +
        let value = match decoder.datatype()? {
          16  +
            ::aws_smithy_cbor::data::Type::Null => {
          17  +
                return ::std::result::Result::Err(
          18  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          19  +
                        "dense list cannot contain null values",
          20  +
                        decoder.position(),
          21  +
                    ),
          22  +
                )
          23  +
            }
          24  +
            _ => decoder.string()?,
          25  +
        };
          26  +
        list.0.push(value);
          27  +
        Ok(list)
          28  +
    }
          29  +
          30  +
    let mut list = crate::unconstrained::foo_enum_list_unconstrained::FooEnumListUnconstrained(
          31  +
        ::std::vec::Vec::new(),
          32  +
    );
          33  +
          34  +
    match decoder.list()? {
          35  +
        None => loop {
          36  +
            match decoder.datatype()? {
          37  +
                ::aws_smithy_cbor::data::Type::Break => {
          38  +
                    decoder.skip()?;
          39  +
                    break;
          40  +
                }
          41  +
                _ => {
          42  +
                    list = member(list, decoder)?;
          43  +
                }
          44  +
            };
          45  +
        },
          46  +
        Some(n) => {
          47  +
            for _ in 0..n {
          48  +
                list = member(list, decoder)?;
          49  +
            }
          50  +
        }
          51  +
    };
          52  +
          53  +
    Ok(list)
          54  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_fractional_seconds.rs

@@ -0,1 +0,60 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_fractional_seconds_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::FractionalSecondsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::fractional_seconds_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_fractional_seconds_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::FractionalSecondsOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/cbor",
          40  +
        );
          41  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          42  +
            builder,
          43  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          44  +
            "rpc-v2-cbor",
          45  +
        );
          46  +
        let http_status: u16 = 200;
          47  +
        builder = builder.status(http_status);
          48  +
        let payload =
          49  +
            crate::protocol_serde::shape_fractional_seconds_output::ser_fractional_seconds_output_output_output(&output)?
          50  +
        ;
          51  +
        let content_length = payload.len();
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_LENGTH,
          55  +
            content_length,
          56  +
        );
          57  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          58  +
        builder.body(body)?
          59  +
    })
          60  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_fractional_seconds_output.rs

@@ -0,1 +0,26 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_fractional_seconds_output_output_output(
           3  +
    value: &crate::output::FractionalSecondsOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_fractional_seconds_output::ser_fractional_seconds_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_fractional_seconds_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::FractionalSecondsOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.datetime {
          22  +
        encoder.str("datetime").timestamp(var_1);
          23  +
    }
          24  +
    encoder.end();
          25  +
    Ok(())
          26  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_struct.rs

@@ -0,1 +0,64 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_greeting_struct(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<crate::model::GreetingStruct, ::aws_smithy_cbor::decode::DeserializeError>
           5  +
{
           6  +
    #[allow(clippy::match_single_binding)]
           7  +
    fn pair(
           8  +
        mut builder: crate::model::greeting_struct::Builder,
           9  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          10  +
    ) -> ::std::result::Result<
          11  +
        crate::model::greeting_struct::Builder,
          12  +
        ::aws_smithy_cbor::decode::DeserializeError,
          13  +
    > {
          14  +
        builder = match decoder.str()?.as_ref() {
          15  +
            "hi" => {
          16  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          17  +
                    Ok(builder.set_hi(Some(decoder.string()?)))
          18  +
                })?
          19  +
            }
          20  +
            _ => {
          21  +
                decoder.skip()?;
          22  +
                builder
          23  +
            }
          24  +
        };
          25  +
        Ok(builder)
          26  +
    }
          27  +
          28  +
    let mut builder = crate::model::greeting_struct::Builder::default();
          29  +
          30  +
    match decoder.map()? {
          31  +
        None => loop {
          32  +
            match decoder.datatype()? {
          33  +
                ::aws_smithy_cbor::data::Type::Break => {
          34  +
                    decoder.skip()?;
          35  +
                    break;
          36  +
                }
          37  +
                _ => {
          38  +
                    builder = pair(builder, decoder)?;
          39  +
                }
          40  +
            };
          41  +
        },
          42  +
        Some(n) => {
          43  +
            for _ in 0..n {
          44  +
                builder = pair(builder, decoder)?;
          45  +
            }
          46  +
        }
          47  +
    };
          48  +
    #[allow(clippy::needless_question_mark)]
          49  +
    {
          50  +
        return Ok(builder.build());
          51  +
    }
          52  +
}
          53  +
          54  +
pub fn ser_greeting_struct(
          55  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          56  +
    #[allow(unused)] input: &crate::model::GreetingStruct,
          57  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          58  +
    encoder.begin_map();
          59  +
    if let Some(var_1) = &input.hi {
          60  +
        encoder.str("hi").str(var_1.as_str());
          61  +
    }
          62  +
    encoder.end();
          63  +
    Ok(())
          64  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors.rs

@@ -0,1 +0,125 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_greeting_with_errors_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::GreetingWithErrorsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::greeting_with_errors_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_greeting_with_errors_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::CONTENT_TYPE,
          39  +
            "application/cbor",
          40  +
        );
          41  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          42  +
            builder,
          43  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          44  +
            "rpc-v2-cbor",
          45  +
        );
          46  +
        let http_status: u16 = 200;
          47  +
        builder = builder.status(http_status);
          48  +
        let payload =
          49  +
            crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
          50  +
        ;
          51  +
        let content_length = payload.len();
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::CONTENT_LENGTH,
          55  +
            content_length,
          56  +
        );
          57  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          58  +
        builder.body(body)?
          59  +
    })
          60  +
}
          61  +
          62  +
#[allow(clippy::unnecessary_wraps)]
          63  +
pub fn ser_greeting_with_errors_http_error(
          64  +
    error: &crate::error::GreetingWithErrorsError,
          65  +
) -> std::result::Result<
          66  +
    ::aws_smithy_legacy_http_server::response::Response,
          67  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          68  +
> {
          69  +
    Ok({
          70  +
        match error {
          71  +
            crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
          72  +
                let payload =
          73  +
                    crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
          74  +
                        output,
          75  +
                    )?;
          76  +
                #[allow(unused_mut)]
          77  +
                let mut builder = ::http::Response::builder();
          78  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          79  +
                    builder,
          80  +
                    ::http::header::CONTENT_TYPE,
          81  +
                    "application/cbor",
          82  +
                );
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          84  +
                    builder,
          85  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          86  +
                    "rpc-v2-cbor",
          87  +
                );
          88  +
                let content_length = payload.len();
          89  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          90  +
                    builder,
          91  +
                    ::http::header::CONTENT_LENGTH,
          92  +
                    content_length,
          93  +
                );
          94  +
                builder
          95  +
                    .status(400)
          96  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
          97  +
            }
          98  +
            crate::error::GreetingWithErrorsError::ComplexError(output) => {
          99  +
                let payload =
         100  +
                    crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
         101  +
                #[allow(unused_mut)]
         102  +
                let mut builder = ::http::Response::builder();
         103  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         104  +
                    builder,
         105  +
                    ::http::header::CONTENT_TYPE,
         106  +
                    "application/cbor",
         107  +
                );
         108  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         109  +
                    builder,
         110  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         111  +
                    "rpc-v2-cbor",
         112  +
                );
         113  +
                let content_length = payload.len();
         114  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         115  +
                    builder,
         116  +
                    ::http::header::CONTENT_LENGTH,
         117  +
                    content_length,
         118  +
                );
         119  +
                builder
         120  +
                    .status(400)
         121  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         122  +
            }
         123  +
        }
         124  +
    })
         125  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_greeting_with_errors_output.rs

@@ -0,1 +0,26 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_greeting_with_errors_output_output_output(
           3  +
    value: &crate::output::GreetingWithErrorsOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_greeting_with_errors_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::GreetingWithErrorsOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.greeting {
          22  +
        encoder.str("greeting").str(var_1.as_str());
          23  +
    }
          24  +
    encoder.end();
          25  +
    Ok(())
          26  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_integer_enum_list.rs

@@ -0,1 +0,47 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_integer_enum_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<::std::vec::Vec<i32>, ::aws_smithy_cbor::decode::DeserializeError> {
           5  +
    fn member(
           6  +
        mut list: ::std::vec::Vec<i32>,
           7  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
           8  +
    ) -> ::std::result::Result<::std::vec::Vec<i32>, ::aws_smithy_cbor::decode::DeserializeError>
           9  +
    {
          10  +
        let value = match decoder.datatype()? {
          11  +
            ::aws_smithy_cbor::data::Type::Null => {
          12  +
                return ::std::result::Result::Err(
          13  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          14  +
                        "dense list cannot contain null values",
          15  +
                        decoder.position(),
          16  +
                    ),
          17  +
                )
          18  +
            }
          19  +
            _ => decoder.integer()?,
          20  +
        };
          21  +
        list.push(value);
          22  +
        Ok(list)
          23  +
    }
          24  +
          25  +
    let mut list = ::std::vec::Vec::new();
          26  +
          27  +
    match decoder.list()? {
          28  +
        None => loop {
          29  +
            match decoder.datatype()? {
          30  +
                ::aws_smithy_cbor::data::Type::Break => {
          31  +
                    decoder.skip()?;
          32  +
                    break;
          33  +
                }
          34  +
                _ => {
          35  +
                    list = member(list, decoder)?;
          36  +
                }
          37  +
            };
          38  +
        },
          39  +
        Some(n) => {
          40  +
            for _ in 0..n {
          41  +
                list = member(list, decoder)?;
          42  +
            }
          43  +
        }
          44  +
    };
          45  +
          46  +
    Ok(list)
          47  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_integer_list.rs

@@ -0,1 +0,47 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_integer_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<::std::vec::Vec<i32>, ::aws_smithy_cbor::decode::DeserializeError> {
           5  +
    fn member(
           6  +
        mut list: ::std::vec::Vec<i32>,
           7  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
           8  +
    ) -> ::std::result::Result<::std::vec::Vec<i32>, ::aws_smithy_cbor::decode::DeserializeError>
           9  +
    {
          10  +
        let value = match decoder.datatype()? {
          11  +
            ::aws_smithy_cbor::data::Type::Null => {
          12  +
                return ::std::result::Result::Err(
          13  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          14  +
                        "dense list cannot contain null values",
          15  +
                        decoder.position(),
          16  +
                    ),
          17  +
                )
          18  +
            }
          19  +
            _ => decoder.integer()?,
          20  +
        };
          21  +
        list.push(value);
          22  +
        Ok(list)
          23  +
    }
          24  +
          25  +
    let mut list = ::std::vec::Vec::new();
          26  +
          27  +
    match decoder.list()? {
          28  +
        None => loop {
          29  +
            match decoder.datatype()? {
          30  +
                ::aws_smithy_cbor::data::Type::Break => {
          31  +
                    decoder.skip()?;
          32  +
                    break;
          33  +
                }
          34  +
                _ => {
          35  +
                    list = member(list, decoder)?;
          36  +
                }
          37  +
            };
          38  +
        },
          39  +
        Some(n) => {
          40  +
            for _ in 0..n {
          41  +
                list = member(list, decoder)?;
          42  +
            }
          43  +
        }
          44  +
    };
          45  +
          46  +
    Ok(list)
          47  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_invalid_greeting.rs

@@ -0,1 +0,29 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_invalid_greeting_error(
           3  +
    value: &crate::error::InvalidGreeting,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting(encoder, value)?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_invalid_greeting(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::error::InvalidGreeting,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    encoder
          22  +
        .str("__type")
          23  +
        .str("smithy.protocoltests.rpcv2Cbor#InvalidGreeting");
          24  +
    if let Some(var_1) = &input.message {
          25  +
        encoder.str("Message").str(var_1.as_str());
          26  +
    }
          27  +
    encoder.end();
          28  +
    Ok(())
          29  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_nested_string_list.rs

@@ -0,1 +0,52 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_nested_string_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<::std::vec::Vec<::std::string::String>>,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn member(
           9  +
        mut list: ::std::vec::Vec<::std::vec::Vec<::std::string::String>>,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        ::std::vec::Vec<::std::vec::Vec<::std::string::String>>,
          13  +
        ::aws_smithy_cbor::decode::DeserializeError,
          14  +
    > {
          15  +
        let value = match decoder.datatype()? {
          16  +
            ::aws_smithy_cbor::data::Type::Null => {
          17  +
                return ::std::result::Result::Err(
          18  +
                    ::aws_smithy_cbor::decode::DeserializeError::custom(
          19  +
                        "dense list cannot contain null values",
          20  +
                        decoder.position(),
          21  +
                    ),
          22  +
                )
          23  +
            }
          24  +
            _ => crate::protocol_serde::shape_string_list::de_string_list(decoder)?,
          25  +
        };
          26  +
        list.push(value);
          27  +
        Ok(list)
          28  +
    }
          29  +
          30  +
    let mut list = ::std::vec::Vec::new();
          31  +
          32  +
    match decoder.list()? {
          33  +
        None => loop {
          34  +
            match decoder.datatype()? {
          35  +
                ::aws_smithy_cbor::data::Type::Break => {
          36  +
                    decoder.skip()?;
          37  +
                    break;
          38  +
                }
          39  +
                _ => {
          40  +
                    list = member(list, decoder)?;
          41  +
                }
          42  +
            };
          43  +
        },
          44  +
        Some(n) => {
          45  +
            for _ in 0..n {
          46  +
                list = member(list, decoder)?;
          47  +
            }
          48  +
        }
          49  +
    };
          50  +
          51  +
    Ok(list)
          52  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_no_input_output.rs

@@ -0,1 +0,53 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_no_input_output_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::NoInputOutputInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::no_input_output_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        input.build()
          23  +
    })
          24  +
}
          25  +
          26  +
#[allow(clippy::unnecessary_wraps)]
          27  +
pub fn ser_no_input_output_http_response(
          28  +
    #[allow(unused_variables)] output: crate::output::NoInputOutputOutput,
          29  +
) -> std::result::Result<
          30  +
    ::aws_smithy_legacy_http_server::response::Response,
          31  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          32  +
> {
          33  +
    Ok({
          34  +
        #[allow(unused_mut)]
          35  +
        let mut builder = ::http::Response::builder();
          36  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          37  +
            builder,
          38  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          39  +
            "rpc-v2-cbor",
          40  +
        );
          41  +
        let http_status: u16 = 200;
          42  +
        builder = builder.status(http_status);
          43  +
        let payload = "";
          44  +
        let content_length = payload.len();
          45  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          46  +
            builder,
          47  +
            ::http::header::CONTENT_LENGTH,
          48  +
            content_length,
          49  +
        );
          50  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          51  +
        builder.body(body)?
          52  +
    })
          53  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults.rs

@@ -0,1 +0,189 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_operation_with_defaults_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::OperationWithDefaultsInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::operation_with_defaults_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input =
          29  +
                crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()?
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_operation_with_defaults_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::OperationWithDefaultsOutput,
          41  +
) -> std::result::Result<
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          44  +
> {
          45  +
    Ok({
          46  +
        #[allow(unused_mut)]
          47  +
        let mut builder = ::http::Response::builder();
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          49  +
            builder,
          50  +
            ::http::header::CONTENT_TYPE,
          51  +
            "application/cbor",
          52  +
        );
          53  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          54  +
            builder,
          55  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          56  +
            "rpc-v2-cbor",
          57  +
        );
          58  +
        let http_status: u16 = 200;
          59  +
        builder = builder.status(http_status);
          60  +
        let payload =
          61  +
            crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output_output(&output)?
          62  +
        ;
          63  +
        let content_length = payload.len();
          64  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          65  +
            builder,
          66  +
            ::http::header::CONTENT_LENGTH,
          67  +
            content_length,
          68  +
        );
          69  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          70  +
        builder.body(body)?
          71  +
    })
          72  +
}
          73  +
          74  +
#[allow(clippy::unnecessary_wraps)]
          75  +
pub fn ser_operation_with_defaults_http_error(
          76  +
    error: &crate::error::OperationWithDefaultsError,
          77  +
) -> std::result::Result<
          78  +
    ::aws_smithy_legacy_http_server::response::Response,
          79  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          80  +
> {
          81  +
    Ok({
          82  +
        match error {
          83  +
            crate::error::OperationWithDefaultsError::ValidationException(output) => {
          84  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          85  +
                #[allow(unused_mut)]
          86  +
                let mut builder = ::http::Response::builder();
          87  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          88  +
                    builder,
          89  +
                    ::http::header::CONTENT_TYPE,
          90  +
                    "application/cbor",
          91  +
                );
          92  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          93  +
                    builder,
          94  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          95  +
                    "rpc-v2-cbor",
          96  +
                );
          97  +
                let content_length = payload.len();
          98  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          99  +
                    builder,
         100  +
                    ::http::header::CONTENT_LENGTH,
         101  +
                    content_length,
         102  +
                );
         103  +
                builder
         104  +
                    .status(400)
         105  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         106  +
            }
         107  +
        }
         108  +
    })
         109  +
}
         110  +
         111  +
pub(crate) fn de_operation_with_defaults(
         112  +
    value: &[u8],
         113  +
    mut builder: crate::input::operation_with_defaults_input::Builder,
         114  +
) -> ::std::result::Result<
         115  +
    crate::input::operation_with_defaults_input::Builder,
         116  +
    ::aws_smithy_cbor::decode::DeserializeError,
         117  +
> {
         118  +
    #[allow(clippy::match_single_binding)]
         119  +
    fn pair(
         120  +
        mut builder: crate::input::operation_with_defaults_input::Builder,
         121  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         122  +
    ) -> ::std::result::Result<
         123  +
        crate::input::operation_with_defaults_input::Builder,
         124  +
        ::aws_smithy_cbor::decode::DeserializeError,
         125  +
    > {
         126  +
        builder = match decoder.str()?.as_ref() {
         127  +
            "defaults" => {
         128  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         129  +
                    Ok(builder.set_defaults(Some(
         130  +
                        crate::protocol_serde::shape_defaults::de_defaults(decoder)?,
         131  +
                    )))
         132  +
                })?
         133  +
            }
         134  +
            "clientOptionalDefaults" => {
         135  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         136  +
                    Ok(builder.set_client_optional_defaults(
         137  +
                Some(
         138  +
                    crate::protocol_serde::shape_client_optional_defaults::de_client_optional_defaults(decoder)?
         139  +
                )
         140  +
            ))
         141  +
                })?
         142  +
            }
         143  +
            "topLevelDefault" => {
         144  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         145  +
                    Ok(builder.set_top_level_default(decoder.string()?))
         146  +
                })?
         147  +
            }
         148  +
            "otherTopLevelDefault" => {
         149  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         150  +
                    Ok(builder.set_other_top_level_default(decoder.integer()?))
         151  +
                })?
         152  +
            }
         153  +
            _ => {
         154  +
                decoder.skip()?;
         155  +
                builder
         156  +
            }
         157  +
        };
         158  +
        Ok(builder)
         159  +
    }
         160  +
         161  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         162  +
         163  +
    match decoder.map()? {
         164  +
        None => loop {
         165  +
            match decoder.datatype()? {
         166  +
                ::aws_smithy_cbor::data::Type::Break => {
         167  +
                    decoder.skip()?;
         168  +
                    break;
         169  +
                }
         170  +
                _ => {
         171  +
                    builder = pair(builder, decoder)?;
         172  +
                }
         173  +
            };
         174  +
        },
         175  +
        Some(n) => {
         176  +
            for _ in 0..n {
         177  +
                builder = pair(builder, decoder)?;
         178  +
            }
         179  +
        }
         180  +
    };
         181  +
         182  +
    if decoder.position() != value.len() {
         183  +
        return Err(
         184  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         185  +
        );
         186  +
    }
         187  +
         188  +
    Ok(builder)
         189  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_operation_with_defaults_output.rs

@@ -0,1 +0,110 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_operation_with_defaults_output_output_output(
           3  +
    value: &crate::output::OperationWithDefaultsOutput,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<u8>,
           6  +
    ::aws_smithy_types::error::operation::SerializationError,
           7  +
> {
           8  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
           9  +
    {
          10  +
        let encoder = &mut encoder;
          11  +
        crate::protocol_serde::shape_operation_with_defaults_output::ser_operation_with_defaults_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_operation_with_defaults_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::OperationWithDefaultsOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    {
          22  +
        encoder
          23  +
            .str("defaultString")
          24  +
            .str(input.default_string.as_str());
          25  +
    }
          26  +
    {
          27  +
        encoder.str("defaultBoolean").boolean(input.default_boolean);
          28  +
    }
          29  +
    {
          30  +
        encoder.str("defaultList");
          31  +
        encoder.array((input.default_list).len());
          32  +
        for item_1 in &input.default_list {
          33  +
            {
          34  +
                encoder.str(item_1.as_str());
          35  +
            }
          36  +
        }
          37  +
    }
          38  +
    {
          39  +
        encoder
          40  +
            .str("defaultTimestamp")
          41  +
            .timestamp(&input.default_timestamp);
          42  +
    }
          43  +
    {
          44  +
        encoder.str("defaultBlob").blob(&input.default_blob);
          45  +
    }
          46  +
    {
          47  +
        encoder.str("defaultByte").byte(input.default_byte);
          48  +
    }
          49  +
    {
          50  +
        encoder.str("defaultShort").short(input.default_short);
          51  +
    }
          52  +
    {
          53  +
        encoder.str("defaultInteger").integer(input.default_integer);
          54  +
    }
          55  +
    {
          56  +
        encoder.str("defaultLong").long(input.default_long);
          57  +
    }
          58  +
    {
          59  +
        encoder.str("defaultFloat").float(input.default_float);
          60  +
    }
          61  +
    {
          62  +
        encoder.str("defaultDouble").double(input.default_double);
          63  +
    }
          64  +
    {
          65  +
        encoder.str("defaultMap");
          66  +
        encoder.map((input.default_map).len());
          67  +
        for (key_2, value_3) in &input.default_map {
          68  +
            {
          69  +
                encoder.str(key_2.as_str()).str(value_3.as_str());
          70  +
            }
          71  +
        }
          72  +
    }
          73  +
    {
          74  +
        encoder.str("defaultEnum").str(input.default_enum.as_str());
          75  +
    }
          76  +
    {
          77  +
        encoder
          78  +
            .str("defaultIntEnum")
          79  +
            .integer(input.default_int_enum);
          80  +
    }
          81  +
    {
          82  +
        encoder.str("emptyString").str(input.empty_string.as_str());
          83  +
    }
          84  +
    {
          85  +
        encoder.str("falseBoolean").boolean(input.false_boolean);
          86  +
    }
          87  +
    {
          88  +
        encoder.str("emptyBlob").blob(&input.empty_blob);
          89  +
    }
          90  +
    {
          91  +
        encoder.str("zeroByte").byte(input.zero_byte);
          92  +
    }
          93  +
    {
          94  +
        encoder.str("zeroShort").short(input.zero_short);
          95  +
    }
          96  +
    {
          97  +
        encoder.str("zeroInteger").integer(input.zero_integer);
          98  +
    }
          99  +
    {
         100  +
        encoder.str("zeroLong").long(input.zero_long);
         101  +
    }
         102  +
    {
         103  +
        encoder.str("zeroFloat").float(input.zero_float);
         104  +
    }
         105  +
    {
         106  +
        encoder.str("zeroDouble").double(input.zero_double);
         107  +
    }
         108  +
    encoder.end();
         109  +
    Ok(())
         110  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor-http0x/rust-server-codegen/src/protocol_serde/shape_optional_input_output.rs

@@ -0,1 +0,130 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_optional_input_output_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::OptionalInputOutputInput,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
           8  +
>
           9  +
where
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          11  +
    B::Data: Send,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          14  +
{
          15  +
    Ok({
          16  +
        #[allow(unused_mut)]
          17  +
        let mut input = crate::input::optional_input_output_input::Builder::default();
          18  +
        #[allow(unused_variables)]
          19  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          20  +
            uri, headers, body, ..
          21  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          22  +
        let bytes = ::hyper::body::to_bytes(body).await?;
          23  +
        if !bytes.is_empty() {
          24  +
            ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                &headers,
          26  +
                Some("application/cbor"),
          27  +
            )?;
          28  +
            input = crate::protocol_serde::shape_optional_input_output::de_optional_input_output(
          29  +
                bytes.as_ref(),
          30  +
                input,
          31  +
            )?;
          32  +
        }
          33  +
        input.build()
          34  +
    })
          35  +
}
          36  +
          37  +
#[allow(clippy::unnecessary_wraps)]
          38  +
pub fn ser_optional_input_output_http_response(
          39  +
    #[allow(unused_variables)] output: crate::output::OptionalInputOutputOutput,
          40  +
) -> std::result::Result<
          41  +
    ::aws_smithy_legacy_http_server::response::Response,
          42  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          43  +
> {
          44  +
    Ok({
          45  +
        #[allow(unused_mut)]
          46  +
        let mut builder = ::http::Response::builder();
          47  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          48  +
            builder,
          49  +
            ::http::header::CONTENT_TYPE,
          50  +
            "application/cbor",
          51  +
        );
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          53  +
            builder,
          54  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          55  +
            "rpc-v2-cbor",
          56  +
        );
          57  +
        let http_status: u16 = 200;
          58  +
        builder = builder.status(http_status);
          59  +
        let payload =
          60  +
            crate::protocol_serde::shape_optional_input_output_output::ser_optional_input_output_output_output_output(&output)?
          61  +
        ;
          62  +
        let content_length = payload.len();
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          64  +
            builder,
          65  +
            ::http::header::CONTENT_LENGTH,
          66  +
            content_length,
          67  +
        );
          68  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          69  +
        builder.body(body)?
          70  +
    })
          71  +
}
          72  +
          73  +
pub(crate) fn de_optional_input_output(
          74  +
    value: &[u8],
          75  +
    mut builder: crate::input::optional_input_output_input::Builder,
          76  +
) -> ::std::result::Result<
          77  +
    crate::input::optional_input_output_input::Builder,
          78  +
    ::aws_smithy_cbor::decode::DeserializeError,
          79  +
> {
          80  +
    #[allow(clippy::match_single_binding)]
          81  +
    fn pair(
          82  +
        mut builder: crate::input::optional_input_output_input::Builder,
          83  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          84  +
    ) -> ::std::result::Result<
          85  +
        crate::input::optional_input_output_input::Builder,
          86  +
        ::aws_smithy_cbor::decode::DeserializeError,
          87  +
    > {
          88  +
        builder = match decoder.str()?.as_ref() {
          89  +
            "value" => {
          90  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          91  +
                    Ok(builder.set_value(Some(decoder.string()?)))
          92  +
                })?
          93  +
            }
          94  +
            _ => {
          95  +
                decoder.skip()?;
          96  +
                builder
          97  +
            }
          98  +
        };
          99  +
        Ok(builder)
         100  +
    }
         101  +
         102  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         103  +
         104  +
    match decoder.map()? {
         105  +
        None => loop {
         106  +
            match decoder.datatype()? {
         107  +
                ::aws_smithy_cbor::data::Type::Break => {
         108  +
                    decoder.skip()?;
         109  +
                    break;
         110  +
                }
         111  +
                _ => {
         112  +
                    builder = pair(builder, decoder)?;
         113  +
                }
         114  +
            };
         115  +
        },
         116  +
        Some(n) => {
         117  +
            for _ in 0..n {
         118  +
                builder = pair(builder, decoder)?;
         119  +
            }
         120  +
        }
         121  +
    };
         122  +
         123  +
    if decoder.position() != value.len() {
         124  +
        return Err(
         125  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         126  +
        );
         127  +
    }
         128  +
         129  +
    Ok(builder)
         130  +
}