Server Test

Server Test

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -0,1 +0,99 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_simple_struct_operation_output_output_output(
           3  +
    value: &crate::output::SimpleStructOperationOutput,
           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_simple_struct_operation_output::ser_simple_struct_operation_output_output(encoder, value )?;
          12  +
    }
          13  +
    ::std::result::Result::Ok(encoder.into_writer())
          14  +
}
          15  +
          16  +
pub fn ser_simple_struct_operation_output_output(
          17  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          18  +
    #[allow(unused)] input: &crate::output::SimpleStructOperationOutput,
          19  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          20  +
    encoder.begin_map();
          21  +
    if let Some(var_1) = &input.blob {
          22  +
        encoder.str("blob").blob(var_1);
          23  +
    }
          24  +
    if let Some(var_2) = &input.boolean {
          25  +
        encoder.str("boolean").boolean(*var_2);
          26  +
    }
          27  +
    if let Some(var_3) = &input.string {
          28  +
        encoder.str("string").str(var_3.as_str());
          29  +
    }
          30  +
    if let Some(var_4) = &input.byte {
          31  +
        encoder.str("byte").byte(*var_4);
          32  +
    }
          33  +
    if let Some(var_5) = &input.short {
          34  +
        encoder.str("short").short(*var_5);
          35  +
    }
          36  +
    if let Some(var_6) = &input.integer {
          37  +
        encoder.str("integer").integer(*var_6);
          38  +
    }
          39  +
    if let Some(var_7) = &input.long {
          40  +
        encoder.str("long").long(*var_7);
          41  +
    }
          42  +
    if let Some(var_8) = &input.float {
          43  +
        encoder.str("float").float(*var_8);
          44  +
    }
          45  +
    if let Some(var_9) = &input.double {
          46  +
        encoder.str("double").double(*var_9);
          47  +
    }
          48  +
    if let Some(var_10) = &input.timestamp {
          49  +
        encoder.str("timestamp").timestamp(var_10);
          50  +
    }
          51  +
    if let Some(var_11) = &input.r#enum {
          52  +
        encoder.str("enum").str(var_11.as_str());
          53  +
    }
          54  +
    {
          55  +
        encoder.str("requiredBlob").blob(&input.required_blob);
          56  +
    }
          57  +
    {
          58  +
        encoder
          59  +
            .str("requiredBoolean")
          60  +
            .boolean(input.required_boolean);
          61  +
    }
          62  +
    {
          63  +
        encoder
          64  +
            .str("requiredString")
          65  +
            .str(input.required_string.as_str());
          66  +
    }
          67  +
    {
          68  +
        encoder.str("requiredByte").byte(input.required_byte);
          69  +
    }
          70  +
    {
          71  +
        encoder.str("requiredShort").short(input.required_short);
          72  +
    }
          73  +
    {
          74  +
        encoder
          75  +
            .str("requiredInteger")
          76  +
            .integer(input.required_integer);
          77  +
    }
          78  +
    {
          79  +
        encoder.str("requiredLong").long(input.required_long);
          80  +
    }
          81  +
    {
          82  +
        encoder.str("requiredFloat").float(input.required_float);
          83  +
    }
          84  +
    {
          85  +
        encoder.str("requiredDouble").double(input.required_double);
          86  +
    }
          87  +
    {
          88  +
        encoder
          89  +
            .str("requiredTimestamp")
          90  +
            .timestamp(&input.required_timestamp);
          91  +
    }
          92  +
    {
          93  +
        encoder
          94  +
            .str("requiredEnum")
          95  +
            .str(input.required_enum.as_str());
          96  +
    }
          97  +
    encoder.end();
          98  +
    Ok(())
          99  +
}

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

@@ -0,1 +0,73 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_simple_union(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<crate::model::SimpleUnion, ::aws_smithy_cbor::decode::DeserializeError> {
           5  +
    fn pair(
           6  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
           7  +
    ) -> ::std::result::Result<crate::model::SimpleUnion, ::aws_smithy_cbor::decode::DeserializeError>
           8  +
    {
           9  +
        Ok(match decoder.str()?.as_ref() {
          10  +
            "blob" => crate::model::SimpleUnion::Blob(decoder.blob()?),
          11  +
            "boolean" => crate::model::SimpleUnion::Boolean(decoder.boolean()?),
          12  +
            "string" => crate::model::SimpleUnion::String(decoder.string()?),
          13  +
            "unit" => {
          14  +
                decoder.skip()?;
          15  +
                crate::model::SimpleUnion::Unit
          16  +
            }
          17  +
            variant => {
          18  +
                return Err(
          19  +
                    ::aws_smithy_cbor::decode::DeserializeError::unknown_union_variant(
          20  +
                        variant,
          21  +
                        decoder.position(),
          22  +
                    ),
          23  +
                )
          24  +
            }
          25  +
        })
          26  +
    }
          27  +
          28  +
    match decoder.map()? {
          29  +
        None => {
          30  +
            let variant = pair(decoder)?;
          31  +
            match decoder.datatype()? {
          32  +
                ::aws_smithy_cbor::data::Type::Break => {
          33  +
                    decoder.skip()?;
          34  +
                    Ok(variant)
          35  +
                }
          36  +
                ty => Err(
          37  +
                    ::aws_smithy_cbor::decode::DeserializeError::unexpected_union_variant(
          38  +
                        ty,
          39  +
                        decoder.position(),
          40  +
                    ),
          41  +
                ),
          42  +
            }
          43  +
        }
          44  +
        Some(1) => pair(decoder),
          45  +
        Some(_) => Err(
          46  +
            ::aws_smithy_cbor::decode::DeserializeError::mixed_union_variants(decoder.position()),
          47  +
        ),
          48  +
    }
          49  +
}
          50  +
          51  +
pub fn ser_simple_union(
          52  +
    encoder: &mut ::aws_smithy_cbor::Encoder,
          53  +
    input: &crate::model::SimpleUnion,
          54  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          55  +
    encoder.map(1);
          56  +
    match input {
          57  +
        crate::model::SimpleUnion::Blob(inner) => {
          58  +
            encoder.str("blob").blob(inner);
          59  +
        }
          60  +
        crate::model::SimpleUnion::Boolean(inner) => {
          61  +
            encoder.str("boolean").boolean(*inner);
          62  +
        }
          63  +
        crate::model::SimpleUnion::String(inner) => {
          64  +
            encoder.str("string").str(inner.as_str());
          65  +
        }
          66  +
        crate::model::SimpleUnion::Unit => {
          67  +
            encoder.str("unit");
          68  +
            encoder.begin_map();
          69  +
            encoder.end();
          70  +
        }
          71  +
    }
          72  +
    ::std::result::Result::Ok(())
          73  +
}

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

@@ -0,1 +0,127 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_single_member_struct_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::SingleMemberStructOperationInput,
           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::single_member_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 = crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation(bytes.as_ref(), input)?;
          29  +
        }
          30  +
        input.build()
          31  +
    })
          32  +
}
          33  +
          34  +
#[allow(clippy::unnecessary_wraps)]
          35  +
pub fn ser_single_member_struct_operation_http_response(
          36  +
    #[allow(unused_variables)] output: crate::output::SingleMemberStructOperationOutput,
          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_single_member_struct_operation_output::ser_single_member_struct_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_single_member_struct_operation(
          71  +
    value: &[u8],
          72  +
    mut builder: crate::input::single_member_struct_operation_input::Builder,
          73  +
) -> ::std::result::Result<
          74  +
    crate::input::single_member_struct_operation_input::Builder,
          75  +
    ::aws_smithy_cbor::decode::DeserializeError,
          76  +
> {
          77  +
    #[allow(clippy::match_single_binding)]
          78  +
    fn pair(
          79  +
        mut builder: crate::input::single_member_struct_operation_input::Builder,
          80  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          81  +
    ) -> ::std::result::Result<
          82  +
        crate::input::single_member_struct_operation_input::Builder,
          83  +
        ::aws_smithy_cbor::decode::DeserializeError,
          84  +
    > {
          85  +
        builder = match decoder.str()?.as_ref() {
          86  +
            "message" => {
          87  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
          88  +
                    Ok(builder.set_message(Some(decoder.string()?)))
          89  +
                })?
          90  +
            }
          91  +
            _ => {
          92  +
                decoder.skip()?;
          93  +
                builder
          94  +
            }
          95  +
        };
          96  +
        Ok(builder)
          97  +
    }
          98  +
          99  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         100  +
         101  +
    match decoder.map()? {
         102  +
        None => loop {
         103  +
            match decoder.datatype()? {
         104  +
                ::aws_smithy_cbor::data::Type::Break => {
         105  +
                    decoder.skip()?;
         106  +
                    break;
         107  +
                }
         108  +
                _ => {
         109  +
                    builder = pair(builder, decoder)?;
         110  +
                }
         111  +
            };
         112  +
        },
         113  +
        Some(n) => {
         114  +
            for _ in 0..n {
         115  +
                builder = pair(builder, decoder)?;
         116  +
            }
         117  +
        }
         118  +
    };
         119  +
         120  +
    if decoder.position() != value.len() {
         121  +
        return Err(
         122  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         123  +
        );
         124  +
    }
         125  +
         126  +
    Ok(builder)
         127  +
}

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

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

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

@@ -0,1 +0,118 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_streaming_operation_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::StreamingOperationInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          12  +
    B::Data: Send,
          13  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          14  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          15  +
{
          16  +
    Ok({
          17  +
        #[allow(unused_mut)]
          18  +
        let mut input = crate::input::streaming_operation_input::Builder::default();
          19  +
        #[allow(unused_variables)]
          20  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          21  +
            uri, headers, body, ..
          22  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          23  +
        if let Some(value) = {
          24  +
            let mut receiver =
          25  +
                crate::protocol_serde::shape_streaming_operation_input::de_events_payload(
          26  +
                    &mut body.into().into_inner(),
          27  +
                )?;
          28  +
            if let Some(_initial_event) = receiver
          29  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          30  +
                                                .await
          31  +
                                                .map_err(
          32  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
          33  +
                                                        #[allow(clippy::useless_conversion)]
          34  +
                                                        format!("{ev_error}").into()
          35  +
                                                    )
          36  +
                                                )? {
          37  +
                                                
          38  +
                                            }
          39  +
            Some(receiver)
          40  +
        } {
          41  +
            input = input.set_events(value)
          42  +
        }
          43  +
        input.build()?
          44  +
    })
          45  +
}
          46  +
          47  +
#[allow(clippy::unnecessary_wraps)]
          48  +
pub fn ser_streaming_operation_http_response(
          49  +
    #[allow(unused_variables)] output: crate::output::StreamingOperationOutput,
          50  +
) -> std::result::Result<
          51  +
    ::aws_smithy_legacy_http_server::response::Response,
          52  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          53  +
> {
          54  +
    Ok({
          55  +
        #[allow(unused_mut)]
          56  +
        let mut builder = ::http::Response::builder();
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          58  +
            builder,
          59  +
            ::http::header::CONTENT_TYPE,
          60  +
            "application/vnd.amazon.eventstream",
          61  +
        );
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          63  +
            builder,
          64  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          65  +
            "rpc-v2-cbor",
          66  +
        );
          67  +
        let http_status: u16 = 200;
          68  +
        builder = builder.status(http_status);
          69  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
          70  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream({
          71  +
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
          72  +
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
          73  +
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
          74  +
                output
          75  +
                    .events
          76  +
                    .into_body_stream(marshaller, error_marshaller, signer)
          77  +
            }),
          78  +
        );
          79  +
        builder.body(body)?
          80  +
    })
          81  +
}
          82  +
          83  +
#[allow(clippy::unnecessary_wraps)]
          84  +
pub fn ser_streaming_operation_http_error(
          85  +
    error: &crate::error::StreamingOperationError,
          86  +
) -> std::result::Result<
          87  +
    ::aws_smithy_legacy_http_server::response::Response,
          88  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          89  +
> {
          90  +
    Ok({
          91  +
        match error {
          92  +
            crate::error::StreamingOperationError::ValidationException(output) => {
          93  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          94  +
                #[allow(unused_mut)]
          95  +
                let mut builder = ::http::Response::builder();
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          97  +
                    builder,
          98  +
                    ::http::header::CONTENT_TYPE,
          99  +
                    "application/vnd.amazon.eventstream",
         100  +
                );
         101  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         102  +
                    builder,
         103  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         104  +
                    "rpc-v2-cbor",
         105  +
                );
         106  +
                let content_length = payload.len();
         107  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         108  +
                    builder,
         109  +
                    ::http::header::CONTENT_LENGTH,
         110  +
                    content_length,
         111  +
                );
         112  +
                builder
         113  +
                    .status(400)
         114  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         115  +
            }
         116  +
        }
         117  +
    })
         118  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_events_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::sigv4_event_stream::SigV4Receiver<
           6  +
        crate::model::Events,
           7  +
        ::aws_smithy_legacy_http::event_stream::MessageStreamError,
           8  +
    >,
           9  +
    ::aws_smithy_cbor::decode::DeserializeError,
          10  +
> {
          11  +
    let unmarshaller = crate::event_stream_serde::EventsUnmarshaller::new();
          12  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          13  +
    let receiver = crate::sigv4_event_stream::SigV4Receiver::new(unmarshaller, body);
          14  +
    Ok(receiver)
          15  +
}

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

@@ -0,1 +0,171 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_streaming_operation_with_initial_data_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::StreamingOperationWithInitialDataInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          12  +
    B::Data: Send,
          13  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          14  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          15  +
{
          16  +
    Ok({
          17  +
        #[allow(unused_mut)]
          18  +
        let mut input =
          19  +
            crate::input::streaming_operation_with_initial_data_input::Builder::default();
          20  +
        #[allow(unused_variables)]
          21  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          22  +
            uri, headers, body, ..
          23  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          24  +
        if let Some(value) = {
          25  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_data_input::de_events_payload(&mut body.into().into_inner())?;
          26  +
            if let Some(_initial_event) = receiver
          27  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          28  +
                                                .await
          29  +
                                                .map_err(
          30  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
          31  +
                                                        #[allow(clippy::useless_conversion)]
          32  +
                                                        format!("{ev_error}").into()
          33  +
                                                    )
          34  +
                                                )? {
          35  +
                                                input = crate::protocol_serde::shape_streaming_operation_with_initial_data::de_streaming_operation_with_initial_data(_initial_event.payload(), input)?;
          36  +
                                            }
          37  +
            Some(receiver)
          38  +
        } {
          39  +
            input = input.set_events(value)
          40  +
        }
          41  +
        input.build()?
          42  +
    })
          43  +
}
          44  +
          45  +
#[allow(clippy::unnecessary_wraps)]
          46  +
pub fn ser_streaming_operation_with_initial_data_http_response(
          47  +
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithInitialDataOutput,
          48  +
) -> std::result::Result<
          49  +
    ::aws_smithy_legacy_http_server::response::Response,
          50  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          51  +
> {
          52  +
    Ok({
          53  +
        #[allow(unused_mut)]
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          56  +
            builder,
          57  +
            ::http::header::CONTENT_TYPE,
          58  +
            "application/vnd.amazon.eventstream",
          59  +
        );
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          61  +
            builder,
          62  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          63  +
            "rpc-v2-cbor",
          64  +
        );
          65  +
        let http_status: u16 = 200;
          66  +
        builder = builder.status(http_status);
          67  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
          68  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream({
          69  +
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
          70  +
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
          71  +
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
          72  +
                output
          73  +
                    .events
          74  +
                    .into_body_stream(marshaller, error_marshaller, signer)
          75  +
            }),
          76  +
        );
          77  +
        builder.body(body)?
          78  +
    })
          79  +
}
          80  +
          81  +
#[allow(clippy::unnecessary_wraps)]
          82  +
pub fn ser_streaming_operation_with_initial_data_http_error(
          83  +
    error: &crate::error::StreamingOperationWithInitialDataError,
          84  +
) -> std::result::Result<
          85  +
    ::aws_smithy_legacy_http_server::response::Response,
          86  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          87  +
> {
          88  +
    Ok({
          89  +
        match error {
          90  +
            crate::error::StreamingOperationWithInitialDataError::ValidationException(output) => {
          91  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          92  +
                #[allow(unused_mut)]
          93  +
                let mut builder = ::http::Response::builder();
          94  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          95  +
                    builder,
          96  +
                    ::http::header::CONTENT_TYPE,
          97  +
                    "application/vnd.amazon.eventstream",
          98  +
                );
          99  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         100  +
                    builder,
         101  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         102  +
                    "rpc-v2-cbor",
         103  +
                );
         104  +
                let content_length = payload.len();
         105  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         106  +
                    builder,
         107  +
                    ::http::header::CONTENT_LENGTH,
         108  +
                    content_length,
         109  +
                );
         110  +
                builder
         111  +
                    .status(400)
         112  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         113  +
            }
         114  +
        }
         115  +
    })
         116  +
}
         117  +
         118  +
pub(crate) fn de_streaming_operation_with_initial_data(
         119  +
    value: &[u8],
         120  +
    mut builder: crate::input::streaming_operation_with_initial_data_input::Builder,
         121  +
) -> ::std::result::Result<
         122  +
    crate::input::streaming_operation_with_initial_data_input::Builder,
         123  +
    ::aws_smithy_cbor::decode::DeserializeError,
         124  +
> {
         125  +
    #[allow(clippy::match_single_binding)]
         126  +
    fn pair(
         127  +
        mut builder: crate::input::streaming_operation_with_initial_data_input::Builder,
         128  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         129  +
    ) -> ::std::result::Result<
         130  +
        crate::input::streaming_operation_with_initial_data_input::Builder,
         131  +
        ::aws_smithy_cbor::decode::DeserializeError,
         132  +
    > {
         133  +
        builder = match decoder.str()?.as_ref() {
         134  +
            "initialData" => builder.set_initial_data(decoder.string()?),
         135  +
            _ => {
         136  +
                decoder.skip()?;
         137  +
                builder
         138  +
            }
         139  +
        };
         140  +
        Ok(builder)
         141  +
    }
         142  +
         143  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         144  +
         145  +
    match decoder.map()? {
         146  +
        None => loop {
         147  +
            match decoder.datatype()? {
         148  +
                ::aws_smithy_cbor::data::Type::Break => {
         149  +
                    decoder.skip()?;
         150  +
                    break;
         151  +
                }
         152  +
                _ => {
         153  +
                    builder = pair(builder, decoder)?;
         154  +
                }
         155  +
            };
         156  +
        },
         157  +
        Some(n) => {
         158  +
            for _ in 0..n {
         159  +
                builder = pair(builder, decoder)?;
         160  +
            }
         161  +
        }
         162  +
    };
         163  +
         164  +
    if decoder.position() != value.len() {
         165  +
        return Err(
         166  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         167  +
        );
         168  +
    }
         169  +
         170  +
    Ok(builder)
         171  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_events_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::sigv4_event_stream::SigV4Receiver<
           6  +
        crate::model::Events,
           7  +
        ::aws_smithy_legacy_http::event_stream::MessageStreamError,
           8  +
    >,
           9  +
    ::aws_smithy_cbor::decode::DeserializeError,
          10  +
> {
          11  +
    let unmarshaller = crate::event_stream_serde::EventsUnmarshaller::new();
          12  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          13  +
    let receiver = crate::sigv4_event_stream::SigV4Receiver::new(unmarshaller, body);
          14  +
    Ok(receiver)
          15  +
}

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

@@ -0,1 +0,118 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_streaming_operation_with_initial_response_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::StreamingOperationWithInitialResponseInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          12  +
    B::Data: Send,
          13  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          14  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          15  +
{
          16  +
    Ok({
          17  +
        #[allow(unused_mut)]
          18  +
        let mut input =
          19  +
            crate::input::streaming_operation_with_initial_response_input::Builder::default();
          20  +
        #[allow(unused_variables)]
          21  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          22  +
            uri, headers, body, ..
          23  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          24  +
        if let Some(value) = {
          25  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_response_input::de_events_payload(&mut body.into().into_inner())?;
          26  +
            if let Some(_initial_event) = receiver
          27  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          28  +
                                                .await
          29  +
                                                .map_err(
          30  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
          31  +
                                                        #[allow(clippy::useless_conversion)]
          32  +
                                                        format!("{ev_error}").into()
          33  +
                                                    )
          34  +
                                                )? {
          35  +
                                                
          36  +
                                            }
          37  +
            Some(receiver)
          38  +
        } {
          39  +
            input = input.set_events(value)
          40  +
        }
          41  +
        input.build()?
          42  +
    })
          43  +
}
          44  +
          45  +
#[allow(clippy::unnecessary_wraps)]
          46  +
pub fn ser_streaming_operation_with_initial_response_http_response(
          47  +
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithInitialResponseOutput,
          48  +
) -> std::result::Result<
          49  +
    ::aws_smithy_legacy_http_server::response::Response,
          50  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          51  +
> {
          52  +
    Ok({
          53  +
        #[allow(unused_mut)]
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          56  +
            builder,
          57  +
            ::http::header::CONTENT_TYPE,
          58  +
            "application/vnd.amazon.eventstream",
          59  +
        );
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          61  +
            builder,
          62  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          63  +
            "rpc-v2-cbor",
          64  +
        );
          65  +
        let http_status: u16 = 200;
          66  +
        builder = builder.status(http_status);
          67  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
          68  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream({
          69  +
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
          70  +
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
          71  +
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
          72  +
                output
          73  +
                    .events
          74  +
                    .into_body_stream(marshaller, error_marshaller, signer)
          75  +
            }),
          76  +
        );
          77  +
        builder.body(body)?
          78  +
    })
          79  +
}
          80  +
          81  +
#[allow(clippy::unnecessary_wraps)]
          82  +
pub fn ser_streaming_operation_with_initial_response_http_error(
          83  +
    error: &crate::error::StreamingOperationWithInitialResponseError,
          84  +
) -> std::result::Result<
          85  +
    ::aws_smithy_legacy_http_server::response::Response,
          86  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          87  +
> {
          88  +
    Ok({
          89  +
        match error {
          90  +
            crate::error::StreamingOperationWithInitialResponseError::ValidationException(
          91  +
                output,
          92  +
            ) => {
          93  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          94  +
                #[allow(unused_mut)]
          95  +
                let mut builder = ::http::Response::builder();
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          97  +
                    builder,
          98  +
                    ::http::header::CONTENT_TYPE,
          99  +
                    "application/vnd.amazon.eventstream",
         100  +
                );
         101  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         102  +
                    builder,
         103  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         104  +
                    "rpc-v2-cbor",
         105  +
                );
         106  +
                let content_length = payload.len();
         107  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         108  +
                    builder,
         109  +
                    ::http::header::CONTENT_LENGTH,
         110  +
                    content_length,
         111  +
                );
         112  +
                builder
         113  +
                    .status(400)
         114  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         115  +
            }
         116  +
        }
         117  +
    })
         118  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_events_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::sigv4_event_stream::SigV4Receiver<
           6  +
        crate::model::Events,
           7  +
        ::aws_smithy_legacy_http::event_stream::MessageStreamError,
           8  +
    >,
           9  +
    ::aws_smithy_cbor::decode::DeserializeError,
          10  +
> {
          11  +
    let unmarshaller = crate::event_stream_serde::EventsUnmarshaller::new();
          12  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          13  +
    let receiver = crate::sigv4_event_stream::SigV4Receiver::new(unmarshaller, body);
          14  +
    Ok(receiver)
          15  +
}

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

@@ -0,1 +0,175 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(clippy::unnecessary_wraps)]
           3  +
pub async fn de_streaming_operation_with_optional_data_http_request<B>(
           4  +
    #[allow(unused_variables)] request: ::http::Request<B>,
           5  +
) -> std::result::Result<
           6  +
    crate::input::StreamingOperationWithOptionalDataInput,
           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: Into<::aws_smithy_types::byte_stream::ByteStream>,
          12  +
    B::Data: Send,
          13  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          14  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          15  +
{
          16  +
    Ok({
          17  +
        #[allow(unused_mut)]
          18  +
        let mut input =
          19  +
            crate::input::streaming_operation_with_optional_data_input::Builder::default();
          20  +
        #[allow(unused_variables)]
          21  +
        let ::aws_smithy_runtime_api::http::RequestParts {
          22  +
            uri, headers, body, ..
          23  +
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          24  +
        if let Some(value) = {
          25  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_optional_data_input::de_events_payload(&mut body.into().into_inner())?;
          26  +
            if let Some(_initial_event) = receiver
          27  +
                                                .try_recv_initial(::aws_smithy_legacy_http::event_stream::InitialMessageType::Request)
          28  +
                                                .await
          29  +
                                                .map_err(
          30  +
                                                    |ev_error| ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
          31  +
                                                        #[allow(clippy::useless_conversion)]
          32  +
                                                        format!("{ev_error}").into()
          33  +
                                                    )
          34  +
                                                )? {
          35  +
                                                input = crate::protocol_serde::shape_streaming_operation_with_optional_data::de_streaming_operation_with_optional_data(_initial_event.payload(), input)?;
          36  +
                                            }
          37  +
            Some(receiver)
          38  +
        } {
          39  +
            input = input.set_events(value)
          40  +
        }
          41  +
        input.build()?
          42  +
    })
          43  +
}
          44  +
          45  +
#[allow(clippy::unnecessary_wraps)]
          46  +
pub fn ser_streaming_operation_with_optional_data_http_response(
          47  +
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithOptionalDataOutput,
          48  +
) -> std::result::Result<
          49  +
    ::aws_smithy_legacy_http_server::response::Response,
          50  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          51  +
> {
          52  +
    Ok({
          53  +
        #[allow(unused_mut)]
          54  +
        let mut builder = ::http::Response::builder();
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          56  +
            builder,
          57  +
            ::http::header::CONTENT_TYPE,
          58  +
            "application/vnd.amazon.eventstream",
          59  +
        );
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          61  +
            builder,
          62  +
            ::http::header::HeaderName::from_static("smithy-protocol"),
          63  +
            "rpc-v2-cbor",
          64  +
        );
          65  +
        let http_status: u16 = 200;
          66  +
        builder = builder.status(http_status);
          67  +
        let body = ::aws_smithy_legacy_http_server::body::boxed(
          68  +
            ::aws_smithy_legacy_http_server::body::Body::wrap_stream({
          69  +
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
          70  +
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
          71  +
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
          72  +
                output
          73  +
                    .events
          74  +
                    .into_body_stream(marshaller, error_marshaller, signer)
          75  +
            }),
          76  +
        );
          77  +
        builder.body(body)?
          78  +
    })
          79  +
}
          80  +
          81  +
#[allow(clippy::unnecessary_wraps)]
          82  +
pub fn ser_streaming_operation_with_optional_data_http_error(
          83  +
    error: &crate::error::StreamingOperationWithOptionalDataError,
          84  +
) -> std::result::Result<
          85  +
    ::aws_smithy_legacy_http_server::response::Response,
          86  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
          87  +
> {
          88  +
    Ok({
          89  +
        match error {
          90  +
            crate::error::StreamingOperationWithOptionalDataError::ValidationException(output) => {
          91  +
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
          92  +
                #[allow(unused_mut)]
          93  +
                let mut builder = ::http::Response::builder();
          94  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
          95  +
                    builder,
          96  +
                    ::http::header::CONTENT_TYPE,
          97  +
                    "application/vnd.amazon.eventstream",
          98  +
                );
          99  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         100  +
                    builder,
         101  +
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         102  +
                    "rpc-v2-cbor",
         103  +
                );
         104  +
                let content_length = payload.len();
         105  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
         106  +
                    builder,
         107  +
                    ::http::header::CONTENT_LENGTH,
         108  +
                    content_length,
         109  +
                );
         110  +
                builder
         111  +
                    .status(400)
         112  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
         113  +
            }
         114  +
        }
         115  +
    })
         116  +
}
         117  +
         118  +
pub(crate) fn de_streaming_operation_with_optional_data(
         119  +
    value: &[u8],
         120  +
    mut builder: crate::input::streaming_operation_with_optional_data_input::Builder,
         121  +
) -> ::std::result::Result<
         122  +
    crate::input::streaming_operation_with_optional_data_input::Builder,
         123  +
    ::aws_smithy_cbor::decode::DeserializeError,
         124  +
> {
         125  +
    #[allow(clippy::match_single_binding)]
         126  +
    fn pair(
         127  +
        mut builder: crate::input::streaming_operation_with_optional_data_input::Builder,
         128  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
         129  +
    ) -> ::std::result::Result<
         130  +
        crate::input::streaming_operation_with_optional_data_input::Builder,
         131  +
        ::aws_smithy_cbor::decode::DeserializeError,
         132  +
    > {
         133  +
        builder = match decoder.str()?.as_ref() {
         134  +
            "optionalData" => {
         135  +
                ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
         136  +
                    Ok(builder.set_optional_data(Some(decoder.string()?)))
         137  +
                })?
         138  +
            }
         139  +
            _ => {
         140  +
                decoder.skip()?;
         141  +
                builder
         142  +
            }
         143  +
        };
         144  +
        Ok(builder)
         145  +
    }
         146  +
         147  +
    let decoder = &mut ::aws_smithy_cbor::Decoder::new(value);
         148  +
         149  +
    match decoder.map()? {
         150  +
        None => loop {
         151  +
            match decoder.datatype()? {
         152  +
                ::aws_smithy_cbor::data::Type::Break => {
         153  +
                    decoder.skip()?;
         154  +
                    break;
         155  +
                }
         156  +
                _ => {
         157  +
                    builder = pair(builder, decoder)?;
         158  +
                }
         159  +
            };
         160  +
        },
         161  +
        Some(n) => {
         162  +
            for _ in 0..n {
         163  +
                builder = pair(builder, decoder)?;
         164  +
            }
         165  +
        }
         166  +
    };
         167  +
         168  +
    if decoder.position() != value.len() {
         169  +
        return Err(
         170  +
            ::aws_smithy_cbor::decode::DeserializeError::expected_end_of_stream(decoder.position()),
         171  +
        );
         172  +
    }
         173  +
         174  +
    Ok(builder)
         175  +
}

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

@@ -0,1 +0,15 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn de_events_payload(
           3  +
    body: &mut ::aws_smithy_types::body::SdkBody,
           4  +
) -> std::result::Result<
           5  +
    crate::sigv4_event_stream::SigV4Receiver<
           6  +
        crate::model::Events,
           7  +
        ::aws_smithy_legacy_http::event_stream::MessageStreamError,
           8  +
    >,
           9  +
    ::aws_smithy_cbor::decode::DeserializeError,
          10  +
> {
          11  +
    let unmarshaller = crate::event_stream_serde::EventsUnmarshaller::new();
          12  +
    let body = std::mem::replace(body, ::aws_smithy_types::body::SdkBody::taken());
          13  +
    let receiver = crate::sigv4_event_stream::SigV4Receiver::new(unmarshaller, body);
          14  +
    Ok(receiver)
          15  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/protocol_serde/shape_struct_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_struct_list(
           3  +
    decoder: &mut ::aws_smithy_cbor::Decoder,
           4  +
) -> ::std::result::Result<
           5  +
    crate::unconstrained::struct_list_unconstrained::StructListUnconstrained,
           6  +
    ::aws_smithy_cbor::decode::DeserializeError,
           7  +
> {
           8  +
    fn member(
           9  +
        mut list: crate::unconstrained::struct_list_unconstrained::StructListUnconstrained,
          10  +
        decoder: &mut ::aws_smithy_cbor::Decoder,
          11  +
    ) -> ::std::result::Result<
          12  +
        crate::unconstrained::struct_list_unconstrained::StructListUnconstrained,
          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_simple_struct::de_simple_struct(decoder)?,
          25  +
        };
          26  +
        list.0.push(value);
          27  +
        Ok(list)
          28  +
    }
          29  +
          30  +
    let mut list = crate::unconstrained::struct_list_unconstrained::StructListUnconstrained(
          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  +
}