Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_error_serialization_operation_output.rs

@@ -0,1 +0,29 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_error_serialization_operation_output_output_output(
           3  +
    value: &crate::output::ErrorSerializationOperationOutput,
           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_error_serialization_operation_output::ser_error_serialization_operation_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_error_serialization_operation_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::ErrorSerializationOperationOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.error_shape {
          22  +
        encoder.str("errorShape");
          23  +
        crate::protocol_serde::shape_validation_exception::ser_validation_exception(
          24  +
            encoder, var_1,
          25  +
        )?;
          26  +
    }
          27  +
    encoder.end();
          28  +
    Ok(())
          29  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_event.rs

@@ -0,1 +0,9 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_event(
           3  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
           4  +
    #[allow(unused)] input: &crate::model::Event,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    encoder.begin_map();
           7  +
    encoder.end();
           8  +
    Ok(())
           9  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_events.rs

@@ -0,1 +0,42 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_a_payload(
           3  +
    input: &crate::model::Event,
           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_event::ser_event(encoder, input)?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_b_payload(
          17  +
    input: &crate::model::Event,
          18  +
) -> std::result::Result<
          19  +
    ::std::vec::Vec<u8>,
          20  +
    ::aws_smithy_types::error::operation::SerializationError,
          21  +
> {
          22  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          23  +
    {
          24  +
        let encoder = &mut encoder;
          25  +
        crate::protocol_serde::shape_event::ser_event(encoder, input)?;
          26  +
    }
          27  +
    ::std::result::Result::Ok(encoder.into_writer())
          28  +
}
          29  +
          30  +
pub fn ser_c_payload(
          31  +
    input: &crate::model::Event,
          32  +
) -> std::result::Result<
          33  +
    ::std::vec::Vec<u8>,
          34  +
    ::aws_smithy_types::error::operation::SerializationError,
          35  +
> {
          36  +
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          37  +
    {
          38  +
        let encoder = &mut encoder;
          39  +
        crate::protocol_serde::shape_event::ser_event(encoder, input)?;
          40  +
    }
          41  +
    ::std::result::Result::Ok(encoder.into_writer())
          42  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_foo_choice.rs

@@ -0,1 +0,59 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_foo_choice(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<crate::model::FooChoice, ::aws_smithy_cbor::decode::DeserializeError> {
           5  +
    fn pair(
           6  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
           7  +
    ) -> ::std::result::Result<crate::model::FooChoice, ::aws_smithy_cbor::decode::DeserializeError>
           8  +
    {
           9  +
        Ok(match decoder.str()?.as_ref() {
          10  +
    "choice1" => crate::model::FooChoice::Choice1(
          11  +
        decoder.string()
          12  +
    ?),
          13  +
    "choice2" => crate::model::FooChoice::Choice2(
          14  +
        crate::protocol_serde::shape_recursive_operation_input_output_nested1::de_recursive_operation_input_output_nested1(decoder)
          15  +
        .map(Box::new)
          16  +
    ?),
          17  +
    variant => return Err(::aws_smithy_cbor::decode::DeserializeError::unknown_union_variant(variant, decoder.position()))
          18  +
    })
          19  +
    }
          20  +
          21  +
    match decoder.map()? {
          22  +
        None => {
          23  +
            let variant = pair(decoder)?;
          24  +
            match decoder.datatype()? {
          25  +
                ::aws_smithy_cbor::data::Type::Break => {
          26  +
                    decoder.skip()?;
          27  +
                    Ok(variant)
          28  +
                }
          29  +
                ty => Err(
          30  +
                    ::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
          31  +
                        ty,
          32  +
                        decoder.position(),
          33  +
                    ),
          34  +
                ),
          35  +
            }
          36  +
        }
          37  +
        Some(1) => pair(decoder),
          38  +
        Some(_) => Err(
          39  +
            ::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position()),
          40  +
        ),
          41  +
    }
          42  +
}
          43  +
          44  +
pub fn ser_foo_choice(
          45  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          46  +
    input: &crate::model::FooChoice,
          47  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          48  +
    encoder.map(1);
          49  +
    match input {
          50  +
        crate::model::FooChoice::Choice1(inner) => {
          51  +
            encoder.str("choice1").str(inner.as_str());
          52  +
        }
          53  +
        crate::model::FooChoice::Choice2(inner) => {
          54  +
            encoder.str("choice2");
          55  +
            crate::protocol_serde::shape_recursive_operation_input_output_nested1::ser_recursive_operation_input_output_nested1(encoder, inner )?;
          56  +
        }
          57  +
    }
          58  +
    ::std::result::Result::Ok(())
          59  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_operation_input_output_nested1.rs

@@ -0,1 +0,93 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_recursive_operation_input_output_nested1(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::model::RecursiveOperationInputOutputNested1,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    #[allow(clippy::match_single_binding)]
           9  +
    fn pair(
          10  +
        mut builder: crate::model::recursive_operation_input_output_nested1::Builder,
          11  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          12  +
    ) -> ::std::result::Result<
          13  +
        crate::model::recursive_operation_input_output_nested1::Builder,
          14  +
        ::aws_smithy_cbor::decode::DeserializeError,
          15  +
    > {
          16  +
        builder = match decoder.str()?.as_ref() {
          17  +
            "foo" => {
          18  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          19  +
                    Ok(builder.set_foo(Some(decoder.string()?)))
          20  +
                })?
          21  +
            }
          22  +
            "nested" => {
          23  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          24  +
                    Ok(builder.set_nested(
          25  +
                    Some(
          26  +
                         {
          27  +
                            let v = crate::protocol_serde::shape_recursive_operation_input_output_nested2::de_recursive_operation_input_output_nested2(decoder)?;
          28  +
                            Box::new(v)
          29  +
                        }
          30  +
                    )
          31  +
                ))
          32  +
                })?
          33  +
            }
          34  +
            "variant" => {
          35  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          36  +
                    Ok(builder.set_variant(Some(
          37  +
                        crate::protocol_serde::shape_foo_choice::de_foo_choice(decoder)?,
          38  +
                    )))
          39  +
                })?
          40  +
            }
          41  +
            _ => {
          42  +
                decoder.skip()?;
          43  +
                builder
          44  +
            }
          45  +
        };
          46  +
        Ok(builder)
          47  +
    }
          48  +
          49  +
    let mut builder = crate::model::recursive_operation_input_output_nested1::Builder::default();
          50  +
          51  +
    match decoder.map()? {
          52  +
        None => loop {
          53  +
            match decoder.datatype()? {
          54  +
                ::aws_smithy_cbor::data::Type::Break => {
          55  +
                    decoder.skip()?;
          56  +
                    break;
          57  +
                }
          58  +
                _ => {
          59  +
                    builder = pair(builder, decoder)?;
          60  +
                }
          61  +
            };
          62  +
        },
          63  +
        Some(n) => {
          64  +
            for _ in 0..n {
          65  +
                builder = pair(builder, decoder)?;
          66  +
            }
          67  +
        }
          68  +
    };
          69  +
    #[allow(clippy::needless_question_mark)]
          70  +
    {
          71  +
        return Ok(builder.build());
          72  +
    }
          73  +
}
          74  +
          75  +
pub fn ser_recursive_operation_input_output_nested1(
          76  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          77  +
    #[allow(unused)] input: &crate::model::RecursiveOperationInputOutputNested1,
          78  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          79  +
    encoder.begin_map();
          80  +
    if let Some(var_1) = &input.foo {
          81  +
        encoder.str("foo").str(var_1.as_str());
          82  +
    }
          83  +
    if let Some(var_2) = &input.nested {
          84  +
        encoder.str("nested");
          85  +
        crate::protocol_serde::shape_recursive_operation_input_output_nested2::ser_recursive_operation_input_output_nested2(encoder, var_2 )?;
          86  +
    }
          87  +
    if let Some(var_3) = &input.variant {
          88  +
        encoder.str("variant");
          89  +
        crate::protocol_serde::shape_foo_choice::ser_foo_choice(encoder, var_3)?;
          90  +
    }
          91  +
    encoder.end();
          92  +
    Ok(())
          93  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_operation_input_output_nested2.rs

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

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_union_operation.rs

@@ -0,1 +0,131 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_recursive_union_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::RecursiveUnionOperationInput,
           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::recursive_union_operation_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_recursive_union_operation::de_recursive_union_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_recursive_union_operation_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::RecursiveUnionOperationOutput,
          37  +
) -> std::result::Result<
          38  +
    ::aws_smithy_legacy_http_server::response::Response,
          39  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          40  +
> {
          41  +
    Ok({
          42  +
        #[allow(unused_mut)]
          43  +
        let mut builder = ::http::Response::builder();
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          45  +
            builder,
          46  +
            ::http::header::CONTENT_TYPE,
          47  +
            "application/cbor",
          48  +
        );
          49  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          50  +
            builder,
          51  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          52  +
            "rpc-v2-cbor",
          53  +
        );
          54  +
        let http_status: u16 = 200;
          55  +
        builder = builder.status(http_status);
          56  +
        let payload =
          57  +
            crate::protocol_serde::shape_recursive_union_operation_output::ser_recursive_union_operation_output_output_output(&output)?
          58  +
        ;
          59  +
        let content_length = payload.len();
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          61  +
            builder,
          62  +
            ::http::header::CONTENT_LENGTH,
          63  +
            content_length,
          64  +
        );
          65  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
          66  +
        builder.body(body)?
          67  +
    })
          68  +
}
          69  +
          70  +
pub(crate) fn de_recursive_union_operation(
          71  +
    value: &[u8],
          72  +
    mut builder: crate::input::recursive_union_operation_input::Builder,
          73  +
) -> ::std::result::Result<
          74  +
    crate::input::recursive_union_operation_input::Builder,
          75  +
    ::aws_smithy_cbor::decode::DeserializeError,
          76  +
> {
          77  +
    #[allow(clippy::match_single_binding)]
          78  +
    fn pair(
          79  +
        mut builder: crate::input::recursive_union_operation_input::Builder,
          80  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          81  +
    ) -> ::std::result::Result<
          82  +
        crate::input::recursive_union_operation_input::Builder,
          83  +
        ::aws_smithy_cbor::decode::DeserializeError,
          84  +
    > {
          85  +
        builder = match decoder.str()?.as_ref() {
          86  +
            "nested" => {
          87  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          88  +
                    Ok(builder.set_nested(
          89  +
                Some(
          90  +
                    crate::protocol_serde::shape_recursive_operation_input_output_nested1::de_recursive_operation_input_output_nested1(decoder)?
          91  +
                )
          92  +
            ))
          93  +
                })?
          94  +
            }
          95  +
            _ => {
          96  +
                decoder.skip()?;
          97  +
                builder
          98  +
            }
          99  +
        };
         100  +
        Ok(builder)
         101  +
    }
         102  +
         103  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         104  +
         105  +
    match decoder.map()? {
         106  +
        None => loop {
         107  +
            match decoder.datatype()? {
         108  +
                ::aws_smithy_cbor::data::Type::Break => {
         109  +
                    decoder.skip()?;
         110  +
                    break;
         111  +
                }
         112  +
                _ => {
         113  +
                    builder = pair(builder, decoder)?;
         114  +
                }
         115  +
            };
         116  +
        },
         117  +
        Some(n) => {
         118  +
            for _ in 0..n {
         119  +
                builder = pair(builder, decoder)?;
         120  +
            }
         121  +
        }
         122  +
    };
         123  +
         124  +
    if decoder.position() != value.len() {
         125  +
        return Err(
         126  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         127  +
        );
         128  +
    }
         129  +
         130  +
    Ok(builder)
         131  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_recursive_union_operation_output.rs

@@ -0,1 +0,27 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_recursive_union_operation_output_output_output(
           3  +
    value: &crate::output::RecursiveUnionOperationOutput,
           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_recursive_union_operation_output::ser_recursive_union_operation_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_recursive_union_operation_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::RecursiveUnionOperationOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.nested {
          22  +
        encoder.str("nested");
          23  +
        crate::protocol_serde::shape_recursive_operation_input_output_nested1::ser_recursive_operation_input_output_nested1(encoder, var_1 )?;
          24  +
    }
          25  +
    encoder.end();
          26  +
    Ok(())
          27  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_simple_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_simple_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    ::std::vec::Vec<::std::string::String>,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn member(
           9  +
        mut list: ::std::vec::Vec<::std::string::String>,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        ::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  +
            _ => decoder.string()?,
          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_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_simple_map.rs

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

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_simple_struct.rs

@@ -0,1 +0,197 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_simple_struct(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::model::simple_struct::Builder,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    #[allow(clippy::match_single_binding)]
           9  +
    fn pair(
          10  +
        mut builder: crate::model::simple_struct::Builder,
          11  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          12  +
    ) -> ::std::result::Result<
          13  +
        crate::model::simple_struct::Builder,
          14  +
        ::aws_smithy_cbor::decode::DeserializeError,
          15  +
    > {
          16  +
        builder = match decoder.str()?.as_ref() {
          17  +
            "blob" => {
          18  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          19  +
                    Ok(builder.set_blob(Some(decoder.blob()?)))
          20  +
                })?
          21  +
            }
          22  +
            "boolean" => {
          23  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          24  +
                    Ok(builder.set_boolean(Some(decoder.boolean()?)))
          25  +
                })?
          26  +
            }
          27  +
            "string" => {
          28  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          29  +
                    Ok(builder.set_string(Some(decoder.string()?)))
          30  +
                })?
          31  +
            }
          32  +
            "byte" => {
          33  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          34  +
                    Ok(builder.set_byte(Some(decoder.byte()?)))
          35  +
                })?
          36  +
            }
          37  +
            "short" => {
          38  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          39  +
                    Ok(builder.set_short(Some(decoder.short()?)))
          40  +
                })?
          41  +
            }
          42  +
            "integer" => {
          43  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          44  +
                    Ok(builder.set_integer(Some(decoder.integer()?)))
          45  +
                })?
          46  +
            }
          47  +
            "long" => {
          48  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          49  +
                    Ok(builder.set_long(Some(decoder.long()?)))
          50  +
                })?
          51  +
            }
          52  +
            "float" => {
          53  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          54  +
                    Ok(builder.set_float(Some(decoder.float()?)))
          55  +
                })?
          56  +
            }
          57  +
            "double" => {
          58  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          59  +
                    Ok(builder.set_double(Some(decoder.double()?)))
          60  +
                })?
          61  +
            }
          62  +
            "timestamp" => {
          63  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          64  +
                    Ok(builder.set_timestamp(Some(decoder.timestamp()?)))
          65  +
                })?
          66  +
            }
          67  +
            "enum" => {
          68  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          69  +
                    Ok(builder.set_enum(Some(decoder.string()?)))
          70  +
                })?
          71  +
            }
          72  +
            "requiredBlob" => builder.set_required_blob(decoder.blob()?),
          73  +
            "requiredBoolean" => builder.set_required_boolean(decoder.boolean()?),
          74  +
            "requiredString" => builder.set_required_string(decoder.string()?),
          75  +
            "requiredByte" => builder.set_required_byte(decoder.byte()?),
          76  +
            "requiredShort" => builder.set_required_short(decoder.short()?),
          77  +
            "requiredInteger" => builder.set_required_integer(decoder.integer()?),
          78  +
            "requiredLong" => builder.set_required_long(decoder.long()?),
          79  +
            "requiredFloat" => builder.set_required_float(decoder.float()?),
          80  +
            "requiredDouble" => builder.set_required_double(decoder.double()?),
          81  +
            "requiredTimestamp" => builder.set_required_timestamp(decoder.timestamp()?),
          82  +
            "requiredEnum" => builder.set_required_enum(decoder.string()?),
          83  +
            _ => {
          84  +
                decoder.skip()?;
          85  +
                builder
          86  +
            }
          87  +
        };
          88  +
        Ok(builder)
          89  +
    }
          90  +
          91  +
    let mut builder = crate::model::simple_struct::Builder::default();
          92  +
          93  +
    match decoder.map()? {
          94  +
        None => loop {
          95  +
            match decoder.datatype()? {
          96  +
                ::aws_smithy_cbor::data::Type::Break => {
          97  +
                    decoder.skip()?;
          98  +
                    break;
          99  +
                }
         100  +
                _ => {
         101  +
                    builder = pair(builder, decoder)?;
         102  +
                }
         103  +
            };
         104  +
        },
         105  +
        Some(n) => {
         106  +
            for _ in 0..n {
         107  +
                builder = pair(builder, decoder)?;
         108  +
            }
         109  +
        }
         110  +
    };
         111  +
    Ok(builder)
         112  +
}
         113  +
         114  +
pub fn ser_simple_struct(
         115  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
         116  +
    #[allow(unused)] input: &crate::model::SimpleStruct,
         117  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
         118  +
    encoder.begin_map();
         119  +
    if let Some(var_1) = &input.blob {
         120  +
        encoder.str("blob").blob(var_1);
         121  +
    }
         122  +
    if let Some(var_2) = &input.boolean {
         123  +
        encoder.str("boolean").boolean(*var_2);
         124  +
    }
         125  +
    if let Some(var_3) = &input.string {
         126  +
        encoder.str("string").str(var_3.as_str());
         127  +
    }
         128  +
    if let Some(var_4) = &input.byte {
         129  +
        encoder.str("byte").byte(*var_4);
         130  +
    }
         131  +
    if let Some(var_5) = &input.short {
         132  +
        encoder.str("short").short(*var_5);
         133  +
    }
         134  +
    if let Some(var_6) = &input.integer {
         135  +
        encoder.str("integer").integer(*var_6);
         136  +
    }
         137  +
    if let Some(var_7) = &input.long {
         138  +
        encoder.str("long").long(*var_7);
         139  +
    }
         140  +
    if let Some(var_8) = &input.float {
         141  +
        encoder.str("float").float(*var_8);
         142  +
    }
         143  +
    if let Some(var_9) = &input.double {
         144  +
        encoder.str("double").double(*var_9);
         145  +
    }
         146  +
    if let Some(var_10) = &input.timestamp {
         147  +
        encoder.str("timestamp").timestamp(var_10);
         148  +
    }
         149  +
    if let Some(var_11) = &input.r#enum {
         150  +
        encoder.str("enum").str(var_11.as_str());
         151  +
    }
         152  +
    {
         153  +
        encoder.str("requiredBlob").blob(&input.required_blob);
         154  +
    }
         155  +
    {
         156  +
        encoder
         157  +
            .str("requiredBoolean")
         158  +
            .boolean(input.required_boolean);
         159  +
    }
         160  +
    {
         161  +
        encoder
         162  +
            .str("requiredString")
         163  +
            .str(input.required_string.as_str());
         164  +
    }
         165  +
    {
         166  +
        encoder.str("requiredByte").byte(input.required_byte);
         167  +
    }
         168  +
    {
         169  +
        encoder.str("requiredShort").short(input.required_short);
         170  +
    }
         171  +
    {
         172  +
        encoder
         173  +
            .str("requiredInteger")
         174  +
            .integer(input.required_integer);
         175  +
    }
         176  +
    {
         177  +
        encoder.str("requiredLong").long(input.required_long);
         178  +
    }
         179  +
    {
         180  +
        encoder.str("requiredFloat").float(input.required_float);
         181  +
    }
         182  +
    {
         183  +
        encoder.str("requiredDouble").double(input.required_double);
         184  +
    }
         185  +
    {
         186  +
        encoder
         187  +
            .str("requiredTimestamp")
         188  +
            .timestamp(&input.required_timestamp);
         189  +
    }
         190  +
    {
         191  +
        encoder
         192  +
            .str("requiredEnum")
         193  +
            .str(input.required_enum.as_str());
         194  +
    }
         195  +
    encoder.end();
         196  +
    Ok(())
         197  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_simple_struct_operation.rs

@@ -0,1 +0,229 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_simple_struct_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::SimpleStructOperationInput,
           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::simple_struct_operation_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_simple_struct_operation::de_simple_struct_operation(
          30  +
                    bytes.as_ref(),
          31  +
                    input,
          32  +
                )?;
          33  +
        }
          34  +
        input.build()?
          35  +
    })
          36  +
}
          37  +
          38  +
#[allow(clippy::unnecessary_wraps)]
          39  +
pub fn ser_simple_struct_operation_http_response(
          40  +
    #[allow(unused_variables)] output: crate::output::SimpleStructOperationOutput,
          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_simple_struct_operation_output::ser_simple_struct_operation_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_simple_struct_operation_http_error(
          76  +
    error: &crate::error::SimpleStructOperationError,
          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::SimpleStructOperationError::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_simple_struct_operation(
         112  +
    value: &[u8],
         113  +
    mut builder: crate::input::simple_struct_operation_input::Builder,
         114  +
) -> ::std::result::Result<
         115  +
    crate::input::simple_struct_operation_input::Builder,
         116  +
    ::aws_smithy_cbor::decode::DeserializeError,
         117  +
> {
         118  +
    #[allow(clippy::match_single_binding)]
         119  +
    fn pair(
         120  +
        mut builder: crate::input::simple_struct_operation_input::Builder,
         121  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         122  +
    ) -> ::std::result::Result<
         123  +
        crate::input::simple_struct_operation_input::Builder,
         124  +
        ::aws_smithy_cbor::decode::DeserializeError,
         125  +
    > {
         126  +
        builder = match decoder.str()?.as_ref() {
         127  +
            "blob" => {
         128  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         129  +
                    Ok(builder.set_blob(Some(decoder.blob()?)))
         130  +
                })?
         131  +
            }
         132  +
            "boolean" => {
         133  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         134  +
                    Ok(builder.set_boolean(Some(decoder.boolean()?)))
         135  +
                })?
         136  +
            }
         137  +
            "string" => {
         138  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         139  +
                    Ok(builder.set_string(Some(decoder.string()?)))
         140  +
                })?
         141  +
            }
         142  +
            "byte" => {
         143  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         144  +
                    Ok(builder.set_byte(Some(decoder.byte()?)))
         145  +
                })?
         146  +
            }
         147  +
            "short" => {
         148  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         149  +
                    Ok(builder.set_short(Some(decoder.short()?)))
         150  +
                })?
         151  +
            }
         152  +
            "integer" => {
         153  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         154  +
                    Ok(builder.set_integer(Some(decoder.integer()?)))
         155  +
                })?
         156  +
            }
         157  +
            "long" => {
         158  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         159  +
                    Ok(builder.set_long(Some(decoder.long()?)))
         160  +
                })?
         161  +
            }
         162  +
            "float" => {
         163  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         164  +
                    Ok(builder.set_float(Some(decoder.float()?)))
         165  +
                })?
         166  +
            }
         167  +
            "double" => {
         168  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         169  +
                    Ok(builder.set_double(Some(decoder.double()?)))
         170  +
                })?
         171  +
            }
         172  +
            "timestamp" => {
         173  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         174  +
                    Ok(builder.set_timestamp(Some(decoder.timestamp()?)))
         175  +
                })?
         176  +
            }
         177  +
            "enum" => {
         178  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         179  +
                    Ok(builder.set_enum(Some(decoder.string()?)))
         180  +
                })?
         181  +
            }
         182  +
            "requiredBlob" => builder.set_required_blob(decoder.blob()?),
         183  +
            "requiredBoolean" => builder.set_required_boolean(decoder.boolean()?),
         184  +
            "requiredString" => builder.set_required_string(decoder.string()?),
         185  +
            "requiredByte" => builder.set_required_byte(decoder.byte()?),
         186  +
            "requiredShort" => builder.set_required_short(decoder.short()?),
         187  +
            "requiredInteger" => builder.set_required_integer(decoder.integer()?),
         188  +
            "requiredLong" => builder.set_required_long(decoder.long()?),
         189  +
            "requiredFloat" => builder.set_required_float(decoder.float()?),
         190  +
            "requiredDouble" => builder.set_required_double(decoder.double()?),
         191  +
            "requiredTimestamp" => builder.set_required_timestamp(decoder.timestamp()?),
         192  +
            "requiredEnum" => builder.set_required_enum(decoder.string()?),
         193  +
            _ => {
         194  +
                decoder.skip()?;
         195  +
                builder
         196  +
            }
         197  +
        };
         198  +
        Ok(builder)
         199  +
    }
         200  +
         201  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         202  +
         203  +
    match decoder.map()? {
         204  +
        None => loop {
         205  +
            match decoder.datatype()? {
         206  +
                ::aws_smithy_cbor::data::Type::Break => {
         207  +
                    decoder.skip()?;
         208  +
                    break;
         209  +
                }
         210  +
                _ => {
         211  +
                    builder = pair(builder, decoder)?;
         212  +
                }
         213  +
            };
         214  +
        },
         215  +
        Some(n) => {
         216  +
            for _ in 0..n {
         217  +
                builder = pair(builder, decoder)?;
         218  +
            }
         219  +
        }
         220  +
    };
         221  +
         222  +
    if decoder.position() != value.len() {
         223  +
        return Err(
         224  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         225  +
        );
         226  +
    }
         227  +
         228  +
    Ok(builder)
         229  +
}