Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras-http0x/rust-server-codegen/src/operation.rs

@@ -0,1 +0,1483 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
::pin_project_lite::pin_project! {
           3  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
           4  +
    /// [`StreamingOperationWithOptionalDataInput`](crate::input::StreamingOperationWithOptionalDataInput) using modelled bindings.
           5  +
    pub struct StreamingOperationWithOptionalDataInputFuture {
           6  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithOptionalDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
           7  +
    }
           8  +
}
           9  +
          10  +
impl std::future::Future for StreamingOperationWithOptionalDataInputFuture {
          11  +
    type Output = Result<
          12  +
        crate::input::StreamingOperationWithOptionalDataInput,
          13  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
          14  +
    >;
          15  +
          16  +
    fn poll(
          17  +
        self: std::pin::Pin<&mut Self>,
          18  +
        cx: &mut std::task::Context<'_>,
          19  +
    ) -> std::task::Poll<Self::Output> {
          20  +
        let this = self.project();
          21  +
        this.inner.as_mut().poll(cx)
          22  +
    }
          23  +
}
          24  +
          25  +
impl<B>
          26  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
          27  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
          28  +
        B,
          29  +
    > for crate::input::StreamingOperationWithOptionalDataInput
          30  +
where
          31  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          32  +
    B: 'static,
          33  +
          34  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          35  +
    B::Data: Send,
          36  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
          37  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          38  +
{
          39  +
    type Rejection =
          40  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
          41  +
    type Future = StreamingOperationWithOptionalDataInputFuture;
          42  +
          43  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          44  +
        let fut = async move {
          45  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
          46  +
                request.headers(),
          47  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
          48  +
            ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
          49  +
                request.headers(),
          50  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
          51  +
            ) {
          52  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
          53  +
            }
          54  +
            crate::protocol_serde::shape_streaming_operation_with_optional_data::de_streaming_operation_with_optional_data_http_request(request)
          55  +
                            .await
          56  +
        };
          57  +
        use ::futures_util::future::TryFutureExt;
          58  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
          59  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
          60  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
          61  +
                    });
          62  +
        StreamingOperationWithOptionalDataInputFuture {
          63  +
            inner: Box::pin(fut),
          64  +
        }
          65  +
    }
          66  +
}
          67  +
impl
          68  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          69  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
          70  +
    > for crate::output::StreamingOperationWithOptionalDataOutput
          71  +
{
          72  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
          73  +
        match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_response(self) {
          74  +
                        Ok(response) => response,
          75  +
                        Err(e) => {
          76  +
                            ::tracing::error!(error = %e, "failed to serialize response");
          77  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
          78  +
                        }
          79  +
                    }
          80  +
    }
          81  +
}
          82  +
impl
          83  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          84  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
          85  +
    > for crate::error::StreamingOperationWithOptionalDataError
          86  +
{
          87  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
          88  +
        match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_error(&self) {
          89  +
            Ok(mut response) => {
          90  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
          91  +
                response
          92  +
            },
          93  +
            Err(e) => {
          94  +
                ::tracing::error!(error = %e, "failed to serialize response");
          95  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
          96  +
            }
          97  +
        }
          98  +
    }
          99  +
}
         100  +
         101  +
::pin_project_lite::pin_project! {
         102  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         103  +
    /// [`StreamingOperationWithInitialResponseInput`](crate::input::StreamingOperationWithInitialResponseInput) using modelled bindings.
         104  +
    pub struct StreamingOperationWithInitialResponseInputFuture {
         105  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialResponseInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         106  +
    }
         107  +
}
         108  +
         109  +
impl std::future::Future for StreamingOperationWithInitialResponseInputFuture {
         110  +
    type Output = Result<
         111  +
        crate::input::StreamingOperationWithInitialResponseInput,
         112  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         113  +
    >;
         114  +
         115  +
    fn poll(
         116  +
        self: std::pin::Pin<&mut Self>,
         117  +
        cx: &mut std::task::Context<'_>,
         118  +
    ) -> std::task::Poll<Self::Output> {
         119  +
        let this = self.project();
         120  +
        this.inner.as_mut().poll(cx)
         121  +
    }
         122  +
}
         123  +
         124  +
impl<B>
         125  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         126  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         127  +
        B,
         128  +
    > for crate::input::StreamingOperationWithInitialResponseInput
         129  +
where
         130  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         131  +
    B: 'static,
         132  +
         133  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         134  +
    B::Data: Send,
         135  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         136  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         137  +
{
         138  +
    type Rejection =
         139  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         140  +
    type Future = StreamingOperationWithInitialResponseInputFuture;
         141  +
         142  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         143  +
        let fut = async move {
         144  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         145  +
                request.headers(),
         146  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
         147  +
            ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         148  +
                request.headers(),
         149  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         150  +
            ) {
         151  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         152  +
            }
         153  +
            crate::protocol_serde::shape_streaming_operation_with_initial_response::de_streaming_operation_with_initial_response_http_request(request)
         154  +
                            .await
         155  +
        };
         156  +
        use ::futures_util::future::TryFutureExt;
         157  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         158  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         159  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         160  +
                    });
         161  +
        StreamingOperationWithInitialResponseInputFuture {
         162  +
            inner: Box::pin(fut),
         163  +
        }
         164  +
    }
         165  +
}
         166  +
impl
         167  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         168  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         169  +
    > for crate::output::StreamingOperationWithInitialResponseOutput
         170  +
{
         171  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         172  +
        match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_response(self) {
         173  +
                        Ok(response) => response,
         174  +
                        Err(e) => {
         175  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         176  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         177  +
                        }
         178  +
                    }
         179  +
    }
         180  +
}
         181  +
impl
         182  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         183  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         184  +
    > for crate::error::StreamingOperationWithInitialResponseError
         185  +
{
         186  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         187  +
        match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_error(&self) {
         188  +
            Ok(mut response) => {
         189  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
         190  +
                response
         191  +
            },
         192  +
            Err(e) => {
         193  +
                ::tracing::error!(error = %e, "failed to serialize response");
         194  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         195  +
            }
         196  +
        }
         197  +
    }
         198  +
}
         199  +
         200  +
::pin_project_lite::pin_project! {
         201  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         202  +
    /// [`StreamingOperationWithInitialDataInput`](crate::input::StreamingOperationWithInitialDataInput) using modelled bindings.
         203  +
    pub struct StreamingOperationWithInitialDataInputFuture {
         204  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         205  +
    }
         206  +
}
         207  +
         208  +
impl std::future::Future for StreamingOperationWithInitialDataInputFuture {
         209  +
    type Output = Result<
         210  +
        crate::input::StreamingOperationWithInitialDataInput,
         211  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         212  +
    >;
         213  +
         214  +
    fn poll(
         215  +
        self: std::pin::Pin<&mut Self>,
         216  +
        cx: &mut std::task::Context<'_>,
         217  +
    ) -> std::task::Poll<Self::Output> {
         218  +
        let this = self.project();
         219  +
        this.inner.as_mut().poll(cx)
         220  +
    }
         221  +
}
         222  +
         223  +
impl<B>
         224  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         225  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         226  +
        B,
         227  +
    > for crate::input::StreamingOperationWithInitialDataInput
         228  +
where
         229  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         230  +
    B: 'static,
         231  +
         232  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         233  +
    B::Data: Send,
         234  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         235  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         236  +
{
         237  +
    type Rejection =
         238  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         239  +
    type Future = StreamingOperationWithInitialDataInputFuture;
         240  +
         241  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         242  +
        let fut = async move {
         243  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         244  +
                request.headers(),
         245  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
         246  +
            ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         247  +
                request.headers(),
         248  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         249  +
            ) {
         250  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         251  +
            }
         252  +
            crate::protocol_serde::shape_streaming_operation_with_initial_data::de_streaming_operation_with_initial_data_http_request(request)
         253  +
                            .await
         254  +
        };
         255  +
        use ::futures_util::future::TryFutureExt;
         256  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         257  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         258  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         259  +
                    });
         260  +
        StreamingOperationWithInitialDataInputFuture {
         261  +
            inner: Box::pin(fut),
         262  +
        }
         263  +
    }
         264  +
}
         265  +
impl
         266  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         267  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         268  +
    > for crate::output::StreamingOperationWithInitialDataOutput
         269  +
{
         270  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         271  +
        match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_response(self) {
         272  +
                        Ok(response) => response,
         273  +
                        Err(e) => {
         274  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         275  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         276  +
                        }
         277  +
                    }
         278  +
    }
         279  +
}
         280  +
impl
         281  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         282  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         283  +
    > for crate::error::StreamingOperationWithInitialDataError
         284  +
{
         285  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         286  +
        match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_error(&self) {
         287  +
            Ok(mut response) => {
         288  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
         289  +
                response
         290  +
            },
         291  +
            Err(e) => {
         292  +
                ::tracing::error!(error = %e, "failed to serialize response");
         293  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         294  +
            }
         295  +
        }
         296  +
    }
         297  +
}
         298  +
         299  +
::pin_project_lite::pin_project! {
         300  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         301  +
    /// [`StreamingOperationInput`](crate::input::StreamingOperationInput) using modelled bindings.
         302  +
    pub struct StreamingOperationInputFuture {
         303  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         304  +
    }
         305  +
}
         306  +
         307  +
impl std::future::Future for StreamingOperationInputFuture {
         308  +
    type Output = Result<
         309  +
        crate::input::StreamingOperationInput,
         310  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         311  +
    >;
         312  +
         313  +
    fn poll(
         314  +
        self: std::pin::Pin<&mut Self>,
         315  +
        cx: &mut std::task::Context<'_>,
         316  +
    ) -> std::task::Poll<Self::Output> {
         317  +
        let this = self.project();
         318  +
        this.inner.as_mut().poll(cx)
         319  +
    }
         320  +
}
         321  +
         322  +
impl<B>
         323  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         324  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         325  +
        B,
         326  +
    > for crate::input::StreamingOperationInput
         327  +
where
         328  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         329  +
    B: 'static,
         330  +
         331  +
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         332  +
    B::Data: Send,
         333  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         334  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         335  +
{
         336  +
    type Rejection =
         337  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         338  +
    type Future = StreamingOperationInputFuture;
         339  +
         340  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         341  +
        let fut = async move {
         342  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         343  +
                request.headers(),
         344  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
         345  +
            ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         346  +
                request.headers(),
         347  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         348  +
            ) {
         349  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         350  +
            }
         351  +
            crate::protocol_serde::shape_streaming_operation::de_streaming_operation_http_request(
         352  +
                request,
         353  +
            )
         354  +
            .await
         355  +
        };
         356  +
        use ::futures_util::future::TryFutureExt;
         357  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         358  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         359  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         360  +
                    });
         361  +
        StreamingOperationInputFuture {
         362  +
            inner: Box::pin(fut),
         363  +
        }
         364  +
    }
         365  +
}
         366  +
impl
         367  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         368  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         369  +
    > for crate::output::StreamingOperationOutput
         370  +
{
         371  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         372  +
        match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_response(self) {
         373  +
                        Ok(response) => response,
         374  +
                        Err(e) => {
         375  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         376  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         377  +
                        }
         378  +
                    }
         379  +
    }
         380  +
}
         381  +
impl
         382  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         383  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         384  +
    > for crate::error::StreamingOperationError
         385  +
{
         386  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         387  +
        match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_error(
         388  +
            &self,
         389  +
        ) {
         390  +
            Ok(mut response) => {
         391  +
                response.extensions_mut().insert(
         392  +
                    ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
         393  +
                        self.name(),
         394  +
                    ),
         395  +
                );
         396  +
                response
         397  +
            }
         398  +
            Err(e) => {
         399  +
                ::tracing::error!(error = %e, "failed to serialize response");
         400  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         401  +
            }
         402  +
        }
         403  +
    }
         404  +
}
         405  +
         406  +
::pin_project_lite::pin_project! {
         407  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         408  +
    /// [`RecursiveUnionOperationInput`](crate::input::RecursiveUnionOperationInput) using modelled bindings.
         409  +
    pub struct RecursiveUnionOperationInputFuture {
         410  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveUnionOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         411  +
    }
         412  +
}
         413  +
         414  +
impl std::future::Future for RecursiveUnionOperationInputFuture {
         415  +
    type Output = Result<
         416  +
        crate::input::RecursiveUnionOperationInput,
         417  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         418  +
    >;
         419  +
         420  +
    fn poll(
         421  +
        self: std::pin::Pin<&mut Self>,
         422  +
        cx: &mut std::task::Context<'_>,
         423  +
    ) -> std::task::Poll<Self::Output> {
         424  +
        let this = self.project();
         425  +
        this.inner.as_mut().poll(cx)
         426  +
    }
         427  +
}
         428  +
         429  +
impl<B>
         430  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         431  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         432  +
        B,
         433  +
    > for crate::input::RecursiveUnionOperationInput
         434  +
where
         435  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         436  +
    B: 'static,
         437  +
         438  +
    B::Data: Send,
         439  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         440  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         441  +
{
         442  +
    type Rejection =
         443  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         444  +
    type Future = RecursiveUnionOperationInputFuture;
         445  +
         446  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         447  +
        let fut = async move {
         448  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         449  +
                request.headers(),
         450  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         451  +
            ) {
         452  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         453  +
            }
         454  +
            crate::protocol_serde::shape_recursive_union_operation::de_recursive_union_operation_http_request(request)
         455  +
                            .await
         456  +
        };
         457  +
        use ::futures_util::future::TryFutureExt;
         458  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         459  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         460  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         461  +
                    });
         462  +
        RecursiveUnionOperationInputFuture {
         463  +
            inner: Box::pin(fut),
         464  +
        }
         465  +
    }
         466  +
}
         467  +
impl
         468  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         469  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         470  +
    > for crate::output::RecursiveUnionOperationOutput
         471  +
{
         472  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         473  +
        match crate::protocol_serde::shape_recursive_union_operation::ser_recursive_union_operation_http_response(self) {
         474  +
                        Ok(response) => response,
         475  +
                        Err(e) => {
         476  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         477  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         478  +
                        }
         479  +
                    }
         480  +
    }
         481  +
}
         482  +
         483  +
#[allow(unreachable_code, unused_variables)]
         484  +
#[cfg(test)]
         485  +
mod recursive_union_operation_test {
         486  +
         487  +
    /// Serializes recursive structures with union
         488  +
    /// Test ID: RpcV2CborRecursiveShapesWithUnion
         489  +
    #[::tokio::test]
         490  +
    #[::tracing_test::traced_test]
         491  +
    async fn rpc_v2_cbor_recursive_shapes_with_union_response() {
         492  +
        let output =crate::output::RecursiveUnionOperationOutput {
         493  +
            nested:
         494  +
                ::std::option::Option::Some(
         495  +
                    crate::model::RecursiveOperationInputOutputNested1 {
         496  +
                        foo:
         497  +
                            ::std::option::Option::Some(
         498  +
                                "Foo1".to_owned()
         499  +
                            )
         500  +
                        ,
         501  +
                        variant:
         502  +
                            ::std::option::Option::Some(
         503  +
                                crate::model::FooChoice::Choice1
         504  +
                                (
         505  +
                                    "OuterChoice".to_owned()
         506  +
                                )
         507  +
                            )
         508  +
                        ,
         509  +
                        nested:
         510  +
                            ::std::option::Option::Some(
         511  +
                                ::std::boxed::Box::new(
         512  +
                                    crate::model::RecursiveOperationInputOutputNested2 {
         513  +
                                        bar:
         514  +
                                            ::std::option::Option::Some(
         515  +
                                                "Bar1".to_owned()
         516  +
                                            )
         517  +
                                        ,
         518  +
                                        recursive_member:
         519  +
                                            ::std::option::Option::Some(
         520  +
                                                crate::model::RecursiveOperationInputOutputNested1 {
         521  +
                                                    foo:
         522  +
                                                        ::std::option::Option::Some(
         523  +
                                                            "Foo2".to_owned()
         524  +
                                                        )
         525  +
                                                    ,
         526  +
                                                    variant:
         527  +
                                                        ::std::option::Option::Some(
         528  +
                                                            crate::model::FooChoice::Choice2
         529  +
                                                            (
         530  +
                                                                ::std::boxed::Box::new(
         531  +
                                                                    crate::model::RecursiveOperationInputOutputNested1 {
         532  +
                                                                        foo:
         533  +
                                                                            ::std::option::Option::Some(
         534  +
                                                                                "Foo3".to_owned()
         535  +
                                                                            )
         536  +
                                                                        ,
         537  +
                                                                        nested:
         538  +
                                                                            ::std::option::Option::Some(
         539  +
                                                                                ::std::boxed::Box::new(
         540  +
                                                                                    crate::model::RecursiveOperationInputOutputNested2 {
         541  +
                                                                                        bar:
         542  +
                                                                                            ::std::option::Option::Some(
         543  +
                                                                                                "Bar3".to_owned()
         544  +
                                                                                            )
         545  +
                                                                                        ,
         546  +
                                                                                        recursive_member:
         547  +
                                                                                            ::std::option::Option::Some(
         548  +
                                                                                                crate::model::RecursiveOperationInputOutputNested1 {
         549  +
                                                                                                    foo:
         550  +
                                                                                                        ::std::option::Option::Some(
         551  +
                                                                                                            "Foo4".to_owned()
         552  +
                                                                                                        )
         553  +
                                                                                                    ,
         554  +
                                                                                                    variant:
         555  +
                                                                                                        ::std::option::Option::Some(
         556  +
                                                                                                            crate::model::FooChoice::Choice1
         557  +
                                                                                                            (
         558  +
                                                                                                                "InnerChoice".to_owned()
         559  +
                                                                                                            )
         560  +
                                                                                                        )
         561  +
                                                                                                    ,
         562  +
                                                                                                    nested:
         563  +
                                                                                                        ::std::option::Option::None
         564  +
                                                                                                    ,
         565  +
                                                                                                }
         566  +
                                                                                            )
         567  +
                                                                                        ,
         568  +
                                                                                    }
         569  +
                                                                                )
         570  +
                                                                            )
         571  +
                                                                        ,
         572  +
                                                                        variant:
         573  +
                                                                            ::std::option::Option::None
         574  +
                                                                        ,
         575  +
                                                                    }
         576  +
                                                                )
         577  +
                                                            )
         578  +
                                                        )
         579  +
                                                    ,
         580  +
                                                    nested:
         581  +
                                                        ::std::option::Option::Some(
         582  +
                                                            ::std::boxed::Box::new(
         583  +
                                                                crate::model::RecursiveOperationInputOutputNested2 {
         584  +
                                                                    bar:
         585  +
                                                                        ::std::option::Option::Some(
         586  +
                                                                            "Bar2".to_owned()
         587  +
                                                                        )
         588  +
                                                                    ,
         589  +
                                                                    recursive_member:
         590  +
                                                                        ::std::option::Option::None
         591  +
                                                                    ,
         592  +
                                                                }
         593  +
                                                            )
         594  +
                                                        )
         595  +
                                                    ,
         596  +
                                                }
         597  +
                                            )
         598  +
                                        ,
         599  +
                                    }
         600  +
                                )
         601  +
                            )
         602  +
                        ,
         603  +
                    }
         604  +
                )
         605  +
            ,
         606  +
        }
         607  +
        ;
         608  +
        use ::aws_smithy_legacy_http_server::response::IntoResponse;
         609  +
        let http_response = output.into_response();
         610  +
        ::pretty_assertions::assert_eq!(
         611  +
            ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
         612  +
            http_response.status()
         613  +
        );
         614  +
        let expected_headers = [
         615  +
            ("Content-Type", "application/cbor"),
         616  +
            ("smithy-protocol", "rpc-v2-cbor"),
         617  +
        ];
         618  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         619  +
            http_response.headers(),
         620  +
            expected_headers,
         621  +
        ));
         622  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
         623  +
            .await
         624  +
            .expect("unable to extract body to bytes");
         625  +
        ::aws_smithy_protocol_test::assert_ok(
         626  +
        ::aws_smithy_protocol_test::validate_body(&body, "v2ZuZXN0ZWS/Y2Zvb2RGb28xZ3ZhcmlhbnS/Z2Nob2ljZTFrT3V0ZXJDaG9pY2X/Zm5lc3RlZL9jYmFyZEJhcjFvcmVjdXJzaXZlTWVtYmVyv2Nmb29kRm9vMmd2YXJpYW50v2djaG9pY2Uyv2Nmb29kRm9vM2ZuZXN0ZWS/Y2JhcmRCYXIzb3JlY3Vyc2l2ZU1lbWJlcr9jZm9vZEZvbzRndmFyaWFudL9nY2hvaWNlMWtJbm5lckNob2ljZf//////Zm5lc3RlZL9jYmFyZEJhcjL//////w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
         627  +
        );
         628  +
    }
         629  +
}
         630  +
         631  +
::pin_project_lite::pin_project! {
         632  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         633  +
    /// [`SingleMemberStructOperationInput`](crate::input::SingleMemberStructOperationInput) using modelled bindings.
         634  +
    pub struct SingleMemberStructOperationInputFuture {
         635  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SingleMemberStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         636  +
    }
         637  +
}
         638  +
         639  +
impl std::future::Future for SingleMemberStructOperationInputFuture {
         640  +
    type Output = Result<
         641  +
        crate::input::SingleMemberStructOperationInput,
         642  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         643  +
    >;
         644  +
         645  +
    fn poll(
         646  +
        self: std::pin::Pin<&mut Self>,
         647  +
        cx: &mut std::task::Context<'_>,
         648  +
    ) -> std::task::Poll<Self::Output> {
         649  +
        let this = self.project();
         650  +
        this.inner.as_mut().poll(cx)
         651  +
    }
         652  +
}
         653  +
         654  +
impl<B>
         655  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         656  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         657  +
        B,
         658  +
    > for crate::input::SingleMemberStructOperationInput
         659  +
where
         660  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         661  +
    B: 'static,
         662  +
         663  +
    B::Data: Send,
         664  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         665  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         666  +
{
         667  +
    type Rejection =
         668  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         669  +
    type Future = SingleMemberStructOperationInputFuture;
         670  +
         671  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         672  +
        let fut = async move {
         673  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         674  +
                request.headers(),
         675  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         676  +
            ) {
         677  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         678  +
            }
         679  +
            crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation_http_request(request)
         680  +
                            .await
         681  +
        };
         682  +
        use ::futures_util::future::TryFutureExt;
         683  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         684  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         685  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         686  +
                    });
         687  +
        SingleMemberStructOperationInputFuture {
         688  +
            inner: Box::pin(fut),
         689  +
        }
         690  +
    }
         691  +
}
         692  +
impl
         693  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         694  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         695  +
    > for crate::output::SingleMemberStructOperationOutput
         696  +
{
         697  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         698  +
        match crate::protocol_serde::shape_single_member_struct_operation::ser_single_member_struct_operation_http_response(self) {
         699  +
                        Ok(response) => response,
         700  +
                        Err(e) => {
         701  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         702  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         703  +
                        }
         704  +
                    }
         705  +
    }
         706  +
}
         707  +
         708  +
#[allow(unreachable_code, unused_variables)]
         709  +
#[cfg(test)]
         710  +
mod single_member_struct_operation_test {
         711  +
         712  +
    /// When additional tokens are found past where we expect the end of the body,
         713  +
    /// the request should be rejected with a serialization exception.
         714  +
    /// Test ID: AdditionalTokensSingleMemberStruct
         715  +
    #[::tokio::test]
         716  +
    #[::tracing_test::traced_test]
         717  +
    async fn additional_tokens_single_member_struct_malformed_request() {
         718  +
        {
         719  +
            #[allow(unused_mut)]
         720  +
            let mut http_request = ::http::Request::builder()
         721  +
                .uri("/service/RpcV2CborService/operation/SingleMemberStructOperation")
         722  +
                .method("POST")
         723  +
                .header("smithy-protocol", "rpc-v2-cbor")
         724  +
                .header("Accept", "application/cbor")
         725  +
                .header("Content-Type", "application/cbor")
         726  +
                .body(::aws_smithy_legacy_http_server::body::Body::from(
         727  +
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
         728  +
                        "v/+//w==".as_bytes(),
         729  +
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
         730  +
                    )),
         731  +
                ))
         732  +
                .unwrap();
         733  +
            #[allow(unused_mut)]
         734  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         735  +
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
         736  +
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
         737  +
                            .single_member_struct_operation(move |input: crate::input::SingleMemberStructOperationInput| {
         738  +
                                let sender = sender.clone();
         739  +
                                async move {
         740  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::SingleMemberStructOperationOutput };
         741  +
                                    sender.send(()).await.expect("receiver dropped early");
         742  +
                                    result
         743  +
                                }
         744  +
                            })
         745  +
                            .build_unchecked();
         746  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         747  +
                .await
         748  +
                .expect("unable to make an HTTP request");
         749  +
            ::pretty_assertions::assert_eq!(
         750  +
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
         751  +
                http_response.status()
         752  +
            );
         753  +
            let body = ::hyper::body::to_bytes(http_response.into_body())
         754  +
                .await
         755  +
                .expect("unable to extract body to bytes");
         756  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         757  +
                &body,
         758  +
                "oA==",
         759  +
                ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
         760  +
            ));
         761  +
        }
         762  +
    }
         763  +
}
         764  +
         765  +
::pin_project_lite::pin_project! {
         766  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         767  +
    /// [`EmptyStructOperationInput`](crate::input::EmptyStructOperationInput) using modelled bindings.
         768  +
    pub struct EmptyStructOperationInputFuture {
         769  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         770  +
    }
         771  +
}
         772  +
         773  +
impl std::future::Future for EmptyStructOperationInputFuture {
         774  +
    type Output = Result<
         775  +
        crate::input::EmptyStructOperationInput,
         776  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         777  +
    >;
         778  +
         779  +
    fn poll(
         780  +
        self: std::pin::Pin<&mut Self>,
         781  +
        cx: &mut std::task::Context<'_>,
         782  +
    ) -> std::task::Poll<Self::Output> {
         783  +
        let this = self.project();
         784  +
        this.inner.as_mut().poll(cx)
         785  +
    }
         786  +
}
         787  +
         788  +
impl<B>
         789  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         790  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         791  +
        B,
         792  +
    > for crate::input::EmptyStructOperationInput
         793  +
where
         794  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         795  +
    B: 'static,
         796  +
         797  +
    B::Data: Send,
         798  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         799  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         800  +
{
         801  +
    type Rejection =
         802  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         803  +
    type Future = EmptyStructOperationInputFuture;
         804  +
         805  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         806  +
        let fut = async move {
         807  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         808  +
                request.headers(),
         809  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         810  +
            ) {
         811  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         812  +
            }
         813  +
            crate::protocol_serde::shape_empty_struct_operation::de_empty_struct_operation_http_request(request)
         814  +
                            .await
         815  +
        };
         816  +
        use ::futures_util::future::TryFutureExt;
         817  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         818  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         819  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         820  +
                    });
         821  +
        EmptyStructOperationInputFuture {
         822  +
            inner: Box::pin(fut),
         823  +
        }
         824  +
    }
         825  +
}
         826  +
impl
         827  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         828  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         829  +
    > for crate::output::EmptyStructOperationOutput
         830  +
{
         831  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         832  +
        match crate::protocol_serde::shape_empty_struct_operation::ser_empty_struct_operation_http_response(self) {
         833  +
                        Ok(response) => response,
         834  +
                        Err(e) => {
         835  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         836  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         837  +
                        }
         838  +
                    }
         839  +
    }
         840  +
}
         841  +
         842  +
#[allow(unreachable_code, unused_variables)]
         843  +
#[cfg(test)]
         844  +
mod empty_struct_operation_test {
         845  +
         846  +
    /// When additional tokens are found past where we expect the end of the body,
         847  +
    /// the request should be rejected with a serialization exception.
         848  +
    /// Test ID: AdditionalTokensEmptyStruct
         849  +
    #[::tokio::test]
         850  +
    #[::tracing_test::traced_test]
         851  +
    #[should_panic]
         852  +
    async fn additional_tokens_empty_struct_malformed_request() {
         853  +
        {
         854  +
            #[allow(unused_mut)]
         855  +
            let mut http_request = ::http::Request::builder()
         856  +
                .uri("/service/RpcV2CborService/operation/EmptyStructOperation")
         857  +
                .method("POST")
         858  +
                .header("smithy-protocol", "rpc-v2-cbor")
         859  +
                .header("Accept", "application/cbor")
         860  +
                .header("Content-Type", "application/cbor")
         861  +
                .body(::aws_smithy_legacy_http_server::body::Body::from(
         862  +
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
         863  +
                        "v/+//w==".as_bytes(),
         864  +
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
         865  +
                    )),
         866  +
                ))
         867  +
                .unwrap();
         868  +
            #[allow(unused_mut)]
         869  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         870  +
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
         871  +
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
         872  +
                            .empty_struct_operation(move |input: crate::input::EmptyStructOperationInput| {
         873  +
                                let sender = sender.clone();
         874  +
                                async move {
         875  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::EmptyStructOperationOutput };
         876  +
                                    sender.send(()).await.expect("receiver dropped early");
         877  +
                                    result
         878  +
                                }
         879  +
                            })
         880  +
                            .build_unchecked();
         881  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         882  +
                .await
         883  +
                .expect("unable to make an HTTP request");
         884  +
            ::pretty_assertions::assert_eq!(
         885  +
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
         886  +
                http_response.status()
         887  +
            );
         888  +
            let body = ::hyper::body::to_bytes(http_response.into_body())
         889  +
                .await
         890  +
                .expect("unable to extract body to bytes");
         891  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         892  +
                &body,
         893  +
                "oA==",
         894  +
                ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
         895  +
            ));
         896  +
        }
         897  +
    }
         898  +
}
         899  +
         900  +
::pin_project_lite::pin_project! {
         901  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         902  +
    /// [`ComplexStructOperationInput`](crate::input::ComplexStructOperationInput) using modelled bindings.
         903  +
    pub struct ComplexStructOperationInputFuture {
         904  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ComplexStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
         905  +
    }
         906  +
}
         907  +
         908  +
impl std::future::Future for ComplexStructOperationInputFuture {
         909  +
    type Output = Result<
         910  +
        crate::input::ComplexStructOperationInput,
         911  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
         912  +
    >;
         913  +
         914  +
    fn poll(
         915  +
        self: std::pin::Pin<&mut Self>,
         916  +
        cx: &mut std::task::Context<'_>,
         917  +
    ) -> std::task::Poll<Self::Output> {
         918  +
        let this = self.project();
         919  +
        this.inner.as_mut().poll(cx)
         920  +
    }
         921  +
}
         922  +
         923  +
impl<B>
         924  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         925  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         926  +
        B,
         927  +
    > for crate::input::ComplexStructOperationInput
         928  +
where
         929  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         930  +
    B: 'static,
         931  +
         932  +
    B::Data: Send,
         933  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
         934  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         935  +
{
         936  +
    type Rejection =
         937  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
         938  +
    type Future = ComplexStructOperationInputFuture;
         939  +
         940  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         941  +
        let fut = async move {
         942  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         943  +
                request.headers(),
         944  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
         945  +
            ) {
         946  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
         947  +
            }
         948  +
            crate::protocol_serde::shape_complex_struct_operation::de_complex_struct_operation_http_request(request)
         949  +
                            .await
         950  +
        };
         951  +
        use ::futures_util::future::TryFutureExt;
         952  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
         953  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         954  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
         955  +
                    });
         956  +
        ComplexStructOperationInputFuture {
         957  +
            inner: Box::pin(fut),
         958  +
        }
         959  +
    }
         960  +
}
         961  +
impl
         962  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         963  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         964  +
    > for crate::output::ComplexStructOperationOutput
         965  +
{
         966  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         967  +
        match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_response(self) {
         968  +
                        Ok(response) => response,
         969  +
                        Err(e) => {
         970  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         971  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         972  +
                        }
         973  +
                    }
         974  +
    }
         975  +
}
         976  +
impl
         977  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         978  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
         979  +
    > for crate::error::ComplexStructOperationError
         980  +
{
         981  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         982  +
        match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_error(&self) {
         983  +
            Ok(mut response) => {
         984  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
         985  +
                response
         986  +
            },
         987  +
            Err(e) => {
         988  +
                ::tracing::error!(error = %e, "failed to serialize response");
         989  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
         990  +
            }
         991  +
        }
         992  +
    }
         993  +
}
         994  +
         995  +
::pin_project_lite::pin_project! {
         996  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         997  +
    /// [`ErrorSerializationOperationInput`](crate::input::ErrorSerializationOperationInput) using modelled bindings.
         998  +
    pub struct ErrorSerializationOperationInputFuture {
         999  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrorSerializationOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
        1000  +
    }
        1001  +
}
        1002  +
        1003  +
impl std::future::Future for ErrorSerializationOperationInputFuture {
        1004  +
    type Output = Result<
        1005  +
        crate::input::ErrorSerializationOperationInput,
        1006  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
        1007  +
    >;
        1008  +
        1009  +
    fn poll(
        1010  +
        self: std::pin::Pin<&mut Self>,
        1011  +
        cx: &mut std::task::Context<'_>,
        1012  +
    ) -> std::task::Poll<Self::Output> {
        1013  +
        let this = self.project();
        1014  +
        this.inner.as_mut().poll(cx)
        1015  +
    }
        1016  +
}
        1017  +
        1018  +
impl<B>
        1019  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
        1020  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1021  +
        B,
        1022  +
    > for crate::input::ErrorSerializationOperationInput
        1023  +
where
        1024  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
        1025  +
    B: 'static,
        1026  +
        1027  +
    B::Data: Send,
        1028  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
        1029  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
        1030  +
{
        1031  +
    type Rejection =
        1032  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
        1033  +
    type Future = ErrorSerializationOperationInputFuture;
        1034  +
        1035  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
        1036  +
        let fut = async move {
        1037  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
        1038  +
                request.headers(),
        1039  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
        1040  +
            ) {
        1041  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
        1042  +
            }
        1043  +
            crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation_http_request(request)
        1044  +
                            .await
        1045  +
        };
        1046  +
        use ::futures_util::future::TryFutureExt;
        1047  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
        1048  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
        1049  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
        1050  +
                    });
        1051  +
        ErrorSerializationOperationInputFuture {
        1052  +
            inner: Box::pin(fut),
        1053  +
        }
        1054  +
    }
        1055  +
}
        1056  +
impl
        1057  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
        1058  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1059  +
    > for crate::output::ErrorSerializationOperationOutput
        1060  +
{
        1061  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
        1062  +
        match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_response(self) {
        1063  +
                        Ok(response) => response,
        1064  +
                        Err(e) => {
        1065  +
                            ::tracing::error!(error = %e, "failed to serialize response");
        1066  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
        1067  +
                        }
        1068  +
                    }
        1069  +
    }
        1070  +
}
        1071  +
impl
        1072  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
        1073  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1074  +
    > for crate::error::ErrorSerializationOperationError
        1075  +
{
        1076  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
        1077  +
        match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_error(&self) {
        1078  +
            Ok(mut response) => {
        1079  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
        1080  +
                response
        1081  +
            },
        1082  +
            Err(e) => {
        1083  +
                ::tracing::error!(error = %e, "failed to serialize response");
        1084  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
        1085  +
            }
        1086  +
        }
        1087  +
    }
        1088  +
}
        1089  +
        1090  +
#[allow(unreachable_code, unused_variables)]
        1091  +
#[cfg(test)]
        1092  +
mod error_serialization_operation_test {
        1093  +
        1094  +
    /// Despite the operation output being a structure shape with the `@error` trait,
        1095  +
    /// `__type` field should, in a strict interpretation of the spec, not be included,
        1096  +
    /// because we're not serializing a server error response. However, we do, because
        1097  +
    /// there shouldn't™️ be any harm in doing so, and it greatly simplifies the
        1098  +
    /// code generator. This test just pins this behavior in case we ever modify it.
        1099  +
    /// Test ID: OperationOutputSerializationQuestionablyIncludesTypeField
        1100  +
    #[::tokio::test]
        1101  +
    #[::tracing_test::traced_test]
        1102  +
    async fn operation_output_serialization_questionably_includes_type_field_response() {
        1103  +
        let output = crate::output::ErrorSerializationOperationOutput {
        1104  +
            error_shape: ::std::option::Option::Some(crate::error::ValidationException {
        1105  +
                message: "ValidationException message field".to_owned(),
        1106  +
                field_list: ::std::option::Option::None,
        1107  +
            }),
        1108  +
        };
        1109  +
        use ::aws_smithy_legacy_http_server::response::IntoResponse;
        1110  +
        let http_response = output.into_response();
        1111  +
        ::pretty_assertions::assert_eq!(
        1112  +
            ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1113  +
            http_response.status()
        1114  +
        );
        1115  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1116  +
            .await
        1117  +
            .expect("unable to extract body to bytes");
        1118  +
        ::aws_smithy_protocol_test::assert_ok(
        1119  +
        ::aws_smithy_protocol_test::validate_body(&body, "v2plcnJvclNoYXBlv2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleCFWYWxpZGF0aW9uRXhjZXB0aW9uIG1lc3NhZ2UgZmllbGT//w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
        1120  +
        );
        1121  +
    }
        1122  +
        1123  +
    /// When invalid input is provided the request should be rejected with
        1124  +
    /// a validation exception, and a `__type` field should be included
        1125  +
    /// Test ID: ErrorSerializationIncludesTypeField
        1126  +
    #[::tokio::test]
        1127  +
    #[::tracing_test::traced_test]
        1128  +
    async fn error_serialization_includes_type_field_malformed_request() {
        1129  +
        {
        1130  +
            #[allow(unused_mut)]
        1131  +
            let mut http_request = ::http::Request::builder()
        1132  +
                .uri("/service/RpcV2CborService/operation/ErrorSerializationOperation")
        1133  +
                .method("POST")
        1134  +
                .header("smithy-protocol", "rpc-v2-cbor")
        1135  +
                .header("Accept", "application/cbor")
        1136  +
                .header("Content-Type", "application/cbor")
        1137  +
                .body(::aws_smithy_legacy_http_server::body::Body::from(
        1138  +
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
        1139  +
                        "oA==".as_bytes(),
        1140  +
                        ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
        1141  +
                    )),
        1142  +
                ))
        1143  +
                .unwrap();
        1144  +
            #[allow(unused_mut)]
        1145  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        1146  +
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
        1147  +
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
        1148  +
                            .error_serialization_operation(move |input: crate::input::ErrorSerializationOperationInput| {
        1149  +
                                let sender = sender.clone();
        1150  +
                                async move {
        1151  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::ErrorSerializationOperationOutput, crate::error::ErrorSerializationOperationError> };
        1152  +
                                    sender.send(()).await.expect("receiver dropped early");
        1153  +
                                    result
        1154  +
                                }
        1155  +
                            })
        1156  +
                            .build_unchecked();
        1157  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        1158  +
                .await
        1159  +
                .expect("unable to make an HTTP request");
        1160  +
            ::pretty_assertions::assert_eq!(
        1161  +
                ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
        1162  +
                http_response.status()
        1163  +
            );
        1164  +
            let body = ::hyper::body::to_bytes(http_response.into_body())
        1165  +
                .await
        1166  +
                .expect("unable to extract body to bytes");
        1167  +
            ::aws_smithy_protocol_test::assert_ok(
        1168  +
            ::aws_smithy_protocol_test::validate_body(&body, "v2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleGsxIHZhbGlkYXRpb24gZXJyb3IgZGV0ZWN0ZWQuIFZhbHVlIGF0ICcvcmVxdWlyZWRCbG9iJyBmYWlsZWQgdG8gc2F0aXNmeSBjb25zdHJhaW50OiBNZW1iZXIgbXVzdCBub3QgYmUgbnVsbGlmaWVsZExpc3SBv2RwYXRobS9yZXF1aXJlZEJsb2JnbWVzc2FnZXhOVmFsdWUgYXQgJy9yZXF1aXJlZEJsb2InIGZhaWxlZCB0byBzYXRpc2Z5IGNvbnN0cmFpbnQ6IE1lbWJlciBtdXN0IG5vdCBiZSBudWxs//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
        1169  +
            );
        1170  +
        }
        1171  +
    }
        1172  +
}
        1173  +
        1174  +
::pin_project_lite::pin_project! {
        1175  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
        1176  +
    /// [`SimpleStructOperationInput`](crate::input::SimpleStructOperationInput) using modelled bindings.
        1177  +
    pub struct SimpleStructOperationInputFuture {
        1178  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
        1179  +
    }
        1180  +
}
        1181  +
        1182  +
impl std::future::Future for SimpleStructOperationInputFuture {
        1183  +
    type Output = Result<
        1184  +
        crate::input::SimpleStructOperationInput,
        1185  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
        1186  +
    >;
        1187  +
        1188  +
    fn poll(
        1189  +
        self: std::pin::Pin<&mut Self>,
        1190  +
        cx: &mut std::task::Context<'_>,
        1191  +
    ) -> std::task::Poll<Self::Output> {
        1192  +
        let this = self.project();
        1193  +
        this.inner.as_mut().poll(cx)
        1194  +
    }
        1195  +
}
        1196  +
        1197  +
impl<B>
        1198  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
        1199  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1200  +
        B,
        1201  +
    > for crate::input::SimpleStructOperationInput
        1202  +
where
        1203  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
        1204  +
    B: 'static,
        1205  +
        1206  +
    B::Data: Send,
        1207  +
    ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
        1208  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
        1209  +
{
        1210  +
    type Rejection =
        1211  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
        1212  +
    type Future = SimpleStructOperationInputFuture;
        1213  +
        1214  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
        1215  +
        let fut = async move {
        1216  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
        1217  +
                request.headers(),
        1218  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
        1219  +
            ) {
        1220  +
                return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
        1221  +
            }
        1222  +
            crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation_http_request(request)
        1223  +
                            .await
        1224  +
        };
        1225  +
        use ::futures_util::future::TryFutureExt;
        1226  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
        1227  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
        1228  +
                        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
        1229  +
                    });
        1230  +
        SimpleStructOperationInputFuture {
        1231  +
            inner: Box::pin(fut),
        1232  +
        }
        1233  +
    }
        1234  +
}
        1235  +
impl
        1236  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
        1237  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1238  +
    > for crate::output::SimpleStructOperationOutput
        1239  +
{
        1240  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
        1241  +
        match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_response(self) {
        1242  +
                        Ok(response) => response,
        1243  +
                        Err(e) => {
        1244  +
                            ::tracing::error!(error = %e, "failed to serialize response");
        1245  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
        1246  +
                        }
        1247  +
                    }
        1248  +
    }
        1249  +
}
        1250  +
impl
        1251  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
        1252  +
        ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
        1253  +
    > for crate::error::SimpleStructOperationError
        1254  +
{
        1255  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
        1256  +
        match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_error(&self) {
        1257  +
            Ok(mut response) => {
        1258  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
        1259  +
                response
        1260  +
            },
        1261  +
            Err(e) => {
        1262  +
                ::tracing::error!(error = %e, "failed to serialize response");
        1263  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
        1264  +
            }
        1265  +
        }
        1266  +
    }
        1267  +
}
        1268  +
        1269  +
#[allow(unreachable_code, unused_variables)]
        1270  +
#[cfg(test)]
        1271  +
mod simple_struct_operation_test {
        1272  +
        1273  +
    /// Test ID: SimpleStruct
        1274  +
    #[::tokio::test]
        1275  +
    #[::tracing_test::traced_test]
        1276  +
    async fn simple_struct_response() {
        1277  +
        let output =crate::output::SimpleStructOperationOutput {
        1278  +
            blob:
        1279  +
                ::std::option::Option::Some(
        1280  +
                    ::aws_smithy_types::Blob::new("blobby blob")
        1281  +
                )
        1282  +
            ,
        1283  +
            boolean:
        1284  +
                ::std::option::Option::Some(
        1285  +
                    false
        1286  +
                )
        1287  +
            ,
        1288  +
            string:
        1289  +
                ::std::option::Option::Some(
        1290  +
                    "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
        1291  +
                )
        1292  +
            ,
        1293  +
            byte:
        1294  +
                ::std::option::Option::Some(
        1295  +
                    69
        1296  +
                )
        1297  +
            ,
        1298  +
            short:
        1299  +
                ::std::option::Option::Some(
        1300  +
                    70
        1301  +
                )
        1302  +
            ,
        1303  +
            integer:
        1304  +
                ::std::option::Option::Some(
        1305  +
                    71
        1306  +
                )
        1307  +
            ,
        1308  +
            long:
        1309  +
                ::std::option::Option::Some(
        1310  +
                    72
        1311  +
                )
        1312  +
            ,
        1313  +
            float:
        1314  +
                ::std::option::Option::Some(
        1315  +
                    0.69_f32
        1316  +
                )
        1317  +
            ,
        1318  +
            double:
        1319  +
                ::std::option::Option::Some(
        1320  +
                    0.6969_f64
        1321  +
                )
        1322  +
            ,
        1323  +
            timestamp:
        1324  +
                ::std::option::Option::Some(
        1325  +
                    ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
        1326  +
                )
        1327  +
            ,
        1328  +
            r#enum:
        1329  +
                ::std::option::Option::Some(
        1330  +
                    "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
        1331  +
                )
        1332  +
            ,
        1333  +
            required_blob:
        1334  +
                ::aws_smithy_types::Blob::new("blobby blob")
        1335  +
            ,
        1336  +
            required_boolean:
        1337  +
                false
        1338  +
            ,
        1339  +
            required_string:
        1340  +
                "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
        1341  +
            ,
        1342  +
            required_byte:
        1343  +
                69
        1344  +
            ,
        1345  +
            required_short:
        1346  +
                70
        1347  +
            ,
        1348  +
            required_integer:
        1349  +
                71
        1350  +
            ,
        1351  +
            required_long:
        1352  +
                72
        1353  +
            ,
        1354  +
            required_float:
        1355  +
                0.69_f32
        1356  +
            ,
        1357  +
            required_double:
        1358  +
                0.6969_f64
        1359  +
            ,
        1360  +
            required_timestamp:
        1361  +
                ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
        1362  +
            ,
        1363  +
            required_enum:
        1364  +
                "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
        1365  +
            ,
        1366  +
        }
        1367  +
        ;
        1368  +
        use ::aws_smithy_legacy_http_server::response::IntoResponse;
        1369  +
        let http_response = output.into_response();
        1370  +
        ::pretty_assertions::assert_eq!(
        1371  +
            ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1372  +
            http_response.status()
        1373  +
        );
        1374  +
        let expected_headers = [
        1375  +
            ("Content-Type", "application/cbor"),
        1376  +
            ("smithy-protocol", "rpc-v2-cbor"),
        1377  +
        ];
        1378  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1379  +
            http_response.headers(),
        1380  +
            expected_headers,
        1381  +
        ));
        1382  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1383  +
            .await
        1384  +
            .expect("unable to extract body to bytes");
        1385  +
        ::aws_smithy_protocol_test::assert_ok(
        1386  +
        ::aws_smithy_protocol_test::validate_body(&body, "v2RibG9iS2Jsb2JieSBibG9iZ2Jvb2xlYW70ZnN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmRieXRlGEVlc2hvcnQYRmdpbnRlZ2VyGEdkbG9uZxhIZWZsb2F0+j8wo9dmZG91Ymxl+z/mTQE6kqMFaXRpbWVzdGFtcMH7QdcKq2AAAABkZW51bWdESUFNT05EbHJlcXVpcmVkQmxvYktibG9iYnkgYmxvYm9yZXF1aXJlZEJvb2xlYW70bnJlcXVpcmVkU3RyaW5neHBUaGVyZSBhcmUgdGhyZWUgdGhpbmdzIGFsbCB3aXNlIG1lbiBmZWFyOiB0aGUgc2VhIGluIHN0b3JtLCBhIG5pZ2h0IHdpdGggbm8gbW9vbiwgYW5kIHRoZSBhbmdlciBvZiBhIGdlbnRsZSBtYW4ubHJlcXVpcmVkQnl0ZRhFbXJlcXVpcmVkU2hvcnQYRm9yZXF1aXJlZEludGVnZXIYR2xyZXF1aXJlZExvbmcYSG1yZXF1aXJlZEZsb2F0+j8wo9ducmVxdWlyZWREb3VibGX7P+ZNATqSowVxcmVxdWlyZWRUaW1lc3RhbXDB+0HXCqtgAAAAbHJlcXVpcmVkRW51bWdESUFNT05E/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
        1387  +
        );
        1388  +
    }
        1389  +
    /// Test ID: SimpleStructWithOptionsSetToNone
        1390  +
    #[::tokio::test]
        1391  +
    #[::tracing_test::traced_test]
        1392  +
    async fn simple_struct_with_options_set_to_none_response() {
        1393  +
        let output =crate::output::SimpleStructOperationOutput {
        1394  +
            required_blob:
        1395  +
                ::aws_smithy_types::Blob::new("blobby blob")
        1396  +
            ,
        1397  +
            required_boolean:
        1398  +
                false
        1399  +
            ,
        1400  +
            required_string:
        1401  +
                "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
        1402  +
            ,
        1403  +
            required_byte:
        1404  +
                69
        1405  +
            ,
        1406  +
            required_short:
        1407  +
                70
        1408  +
            ,
        1409  +
            required_integer:
        1410  +
                71
        1411  +
            ,
        1412  +
            required_long:
        1413  +
                72
        1414  +
            ,
        1415  +
            required_float:
        1416  +
                0.69_f32
        1417  +
            ,
        1418  +
            required_double:
        1419  +
                0.6969_f64
        1420  +
            ,
        1421  +
            required_timestamp:
        1422  +
                ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
        1423  +
            ,
        1424  +
            required_enum:
        1425  +
                "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
        1426  +
            ,
        1427  +
            blob:
        1428  +
                ::std::option::Option::None
        1429  +
            ,
        1430  +
            boolean:
        1431  +
                ::std::option::Option::None
        1432  +
            ,
        1433  +
            string:
        1434  +
                ::std::option::Option::None
        1435  +
            ,
        1436  +
            byte:
        1437  +
                ::std::option::Option::None
        1438  +
            ,
        1439  +
            short:
        1440  +
                ::std::option::Option::None
        1441  +
            ,
        1442  +
            integer:
        1443  +
                ::std::option::Option::None
        1444  +
            ,
        1445  +
            long:
        1446  +
                ::std::option::Option::None
        1447  +
            ,
        1448  +
            float:
        1449  +
                ::std::option::Option::None
        1450  +
            ,
        1451  +
            double:
        1452  +
                ::std::option::Option::None
        1453  +
            ,
        1454  +
            timestamp:
        1455  +
                ::std::option::Option::None
        1456  +
            ,
        1457  +
            r#enum:
        1458  +
                ::std::option::Option::None
        1459  +
            ,
        1460  +
        }
        1461  +
        ;
        1462  +
        use ::aws_smithy_legacy_http_server::response::IntoResponse;
        1463  +
        let http_response = output.into_response();
        1464  +
        ::pretty_assertions::assert_eq!(
        1465  +
            ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1466  +
            http_response.status()
        1467  +
        );
        1468  +
        let expected_headers = [
        1469  +
            ("Content-Type", "application/cbor"),
        1470  +
            ("smithy-protocol", "rpc-v2-cbor"),
        1471  +
        ];
        1472  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1473  +
            http_response.headers(),
        1474  +
            expected_headers,
        1475  +
        ));
        1476  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1477  +
            .await
        1478  +
            .expect("unable to extract body to bytes");
        1479  +
        ::aws_smithy_protocol_test::assert_ok(
        1480  +
        ::aws_smithy_protocol_test::validate_body(&body, "v2xyZXF1aXJlZEJsb2JLYmxvYmJ5IGJsb2JvcmVxdWlyZWRCb29sZWFu9G5yZXF1aXJlZFN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmxyZXF1aXJlZEJ5dGUYRW1yZXF1aXJlZFNob3J0GEZvcmVxdWlyZWRJbnRlZ2VyGEdscmVxdWlyZWRMb25nGEhtcmVxdWlyZWRGbG9hdPo/MKPXbnJlcXVpcmVkRG91Ymxl+z/mTQE6kqMFcXJlcXVpcmVkVGltZXN0YW1wwftB1wqrYAAAAGxyZXF1aXJlZEVudW1nRElBTU9ORP8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
        1481  +
        );
        1482  +
    }
        1483  +
}