Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5

Files changed:

tmp-codegen-diff/codegen-server-test/naming_test_ops-http0x/rust-server-codegen/src/lib.rs

@@ -0,1 +0,277 @@
           1  +
#![allow(deprecated)]
           2  +
#![allow(unknown_lints)]
           3  +
#![allow(clippy::module_inception)]
           4  +
#![allow(clippy::upper_case_acronyms)]
           5  +
#![allow(clippy::large_enum_variant)]
           6  +
#![allow(clippy::wrong_self_convention)]
           7  +
#![allow(clippy::should_implement_trait)]
           8  +
#![allow(clippy::disallowed_names)]
           9  +
#![allow(clippy::vec_init_then_push)]
          10  +
#![allow(clippy::type_complexity)]
          11  +
#![allow(clippy::needless_return)]
          12  +
#![allow(clippy::derive_partial_eq_without_eq)]
          13  +
#![allow(clippy::result_large_err)]
          14  +
#![allow(clippy::unnecessary_map_on_constructor)]
          15  +
#![allow(clippy::deprecated_semver)]
          16  +
#![allow(clippy::uninlined_format_args)]
          17  +
#![allow(rustdoc::bare_urls)]
          18  +
#![allow(rustdoc::redundant_explicit_links)]
          19  +
#![allow(rustdoc::invalid_html_tags)]
          20  +
#![forbid(unsafe_code)]
          21  +
#![cfg_attr(docsrs, feature(doc_cfg))]
          22  +
//! Confounds model generation machinery with lots of problematic names
          23  +
          24  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
          25  +
//! A fast and customizable Rust implementation of the Config Smithy service.
          26  +
//!
          27  +
//! # Using Config
          28  +
//!
          29  +
//! The primary entrypoint is [`Config`]: it satisfies the [`Service<http::Request, Response = http::Response>`](::tower::Service)
          30  +
//! trait and therefore can be handed to a [`hyper` server](https://github.com/hyperium/hyper) via [`Config::into_make_service`]
          31  +
//! or used in AWS Lambda
          32  +
#![cfg_attr(
          33  +
    feature = "aws-lambda",
          34  +
    doc = " via [`LambdaHandler`](crate::server::routing::LambdaHandler)."
          35  +
)]
          36  +
#![cfg_attr(
          37  +
    not(feature = "aws-lambda"),
          38  +
    doc = " by enabling the `aws-lambda` feature flag and utilizing the `LambdaHandler`."
          39  +
)]
          40  +
//! The [`crate::input`], [`crate::output`], and [`crate::error`]
          41  +
//! modules provide the types used in each operation.
          42  +
//!
          43  +
//! ### Running on Hyper
          44  +
//!
          45  +
//! ```rust,no_run
          46  +
//! # use std::net::SocketAddr;
          47  +
//! # async fn dummy() {
          48  +
//! use naming_test_ops_http0x::{Config, ConfigConfig};
          49  +
//!
          50  +
//! # let app = Config::builder(
          51  +
//! #     ConfigConfig::builder()
          52  +
//! #         .build()
          53  +
//! # ).build_unchecked();
          54  +
//! let server = app.into_make_service();
          55  +
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
          56  +
//!     .expect("unable to parse the server bind address and port");
          57  +
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
          58  +
//! # }
          59  +
//!
          60  +
//! ```
          61  +
//!
          62  +
//! ### Running on Lambda
          63  +
//!
          64  +
//! ```rust,ignore
          65  +
//! use naming_test_ops_http0x::server::routing::LambdaHandler;
          66  +
//! use naming_test_ops_http0x::Config;
          67  +
//!
          68  +
//! # async fn dummy() {
          69  +
//! # let app = Config::builder(
          70  +
//! #     ConfigConfig::builder()
          71  +
//! #         .build()
          72  +
//! # ).build_unchecked();
          73  +
//! let handler = LambdaHandler::new(app);
          74  +
//! lambda_http::run(handler).await.unwrap();
          75  +
//! # }
          76  +
//! ```
          77  +
//!
          78  +
//! # Building the Config
          79  +
//!
          80  +
//! To construct [`Config`] we use [`ConfigBuilder`] returned by [`Config::builder`].
          81  +
//!
          82  +
//! ## Plugins
          83  +
//!
          84  +
//! The [`Config::builder`] method, returning [`ConfigBuilder`],
          85  +
//! accepts a config object on which plugins can be registered.
          86  +
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
          87  +
//!
          88  +
//! ```rust,no_run
          89  +
//! # use naming_test_ops_http0x::server::plugin::IdentityPlugin as LoggingPlugin;
          90  +
//! # use naming_test_ops_http0x::server::plugin::IdentityPlugin as MetricsPlugin;
          91  +
//! # use ::hyper::Body;
          92  +
//! use naming_test_ops_http0x::server::plugin::HttpPlugins;
          93  +
//! use naming_test_ops_http0x::{Config, ConfigConfig, ConfigBuilder};
          94  +
//!
          95  +
//! let http_plugins = HttpPlugins::new()
          96  +
//!         .push(LoggingPlugin)
          97  +
//!         .push(MetricsPlugin);
          98  +
//! let config = ConfigConfig::builder().build();
          99  +
//! let builder: ConfigBuilder<::hyper::Body, _, _, _> = Config::builder(config);
         100  +
//! ```
         101  +
//!
         102  +
//! Check out [`crate::server::plugin`] to learn more about plugins.
         103  +
//!
         104  +
//! ## Handlers
         105  +
//!
         106  +
//! [`ConfigBuilder`] provides a setter method for each operation in your Smithy model. The setter methods expect an async function as input, matching the signature for the corresponding operation in your Smithy model.
         107  +
//! We call these async functions **handlers**. This is where your application business logic lives.
         108  +
//!
         109  +
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
         110  +
//!
         111  +
//! * A `Result<Output, Error>` if your operation has modeled errors, or
         112  +
//! * An `Output` otherwise.
         113  +
//!
         114  +
//! ```rust,no_run
         115  +
//! # struct Input;
         116  +
//! # struct Output;
         117  +
//! # struct Error;
         118  +
//! async fn infallible_handler(input: Input) -> Output { todo!() }
         119  +
//!
         120  +
//! async fn fallible_handler(input: Input) -> Result<Output, Error> { todo!() }
         121  +
//! ```
         122  +
//!
         123  +
//! Handlers can accept up to 8 extractors:
         124  +
//!
         125  +
//! ```rust,no_run
         126  +
//! # struct Input;
         127  +
//! # struct Output;
         128  +
//! # struct Error;
         129  +
//! # struct State;
         130  +
//! # use std::net::SocketAddr;
         131  +
//! use naming_test_ops_http0x::server::request::{extension::Extension, connect_info::ConnectInfo};
         132  +
//!
         133  +
//! async fn handler_with_no_extensions(input: Input) -> Output {
         134  +
//!     todo!()
         135  +
//! }
         136  +
//!
         137  +
//! async fn handler_with_one_extractor(input: Input, ext: Extension<State>) -> Output {
         138  +
//!     todo!()
         139  +
//! }
         140  +
//!
         141  +
//! async fn handler_with_two_extractors(
         142  +
//!     input: Input,
         143  +
//!     ext0: Extension<State>,
         144  +
//!     ext1: ConnectInfo<SocketAddr>,
         145  +
//! ) -> Output {
         146  +
//!     todo!()
         147  +
//! }
         148  +
//! ```
         149  +
//!
         150  +
//! See the [`operation module`](crate::operation) for information on precisely what constitutes a handler.
         151  +
//!
         152  +
//! ## Build
         153  +
//!
         154  +
//! You can convert [`ConfigBuilder`] into [`Config`] using either [`ConfigBuilder::build`] or [`ConfigBuilder::build_unchecked`].
         155  +
//!
         156  +
//! [`ConfigBuilder::build`] requires you to provide a handler for every single operation in your Smithy model. It will return an error if that is not the case.
         157  +
//!
         158  +
//! [`ConfigBuilder::build_unchecked`], instead, does not require exhaustiveness. The server will automatically return 500 Internal Server Error to all requests for operations that do not have a registered handler.
         159  +
//! [`ConfigBuilder::build_unchecked`] is particularly useful if you are deploying your Smithy service as a collection of Lambda functions, where each Lambda is only responsible for a subset of the operations in the Smithy service (or even a single one!).
         160  +
//!
         161  +
//! # Example
         162  +
//!
         163  +
//! ```rust,no_run
         164  +
//! # use std::net::SocketAddr;
         165  +
//! use naming_test_ops_http0x::{Config, ConfigConfig};
         166  +
//!
         167  +
//! #[::tokio::main]
         168  +
//! pub async fn main() {
         169  +
//!    let config = ConfigConfig::builder().build();
         170  +
//!    let app = Config::builder(config)
         171  +
//!        .err_collisions(err_collisions)
         172  +
//!        .r#match(r#match)
         173  +
//!        .option(option)
         174  +
//!        .reserved_words_as_members(reserved_words_as_members)
         175  +
//!        .result(result)
         176  +
//!        .rpc_echo(rpc_echo)
         177  +
//!        .structure_name_punning(structure_name_punning)
         178  +
//!        .build()
         179  +
//!        .expect("failed to build an instance of Config");
         180  +
//!
         181  +
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
         182  +
//!        .expect("unable to parse the server bind address and port");
         183  +
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
         184  +
//!    # let server = async { Ok::<_, ()>(()) };
         185  +
//!
         186  +
//!    // Run your service!
         187  +
//!    if let Err(err) = server.await {
         188  +
//!        eprintln!("server error: {:?}", err);
         189  +
//!    }
         190  +
//! }
         191  +
//!
         192  +
//! use naming_test_ops_http0x::{input, output, error};
         193  +
//!
         194  +
//! async fn err_collisions(input: input::ErrCollisionsInput) -> Result<output::ErrCollisionsOutput, error::ErrCollisionsError> {
         195  +
//!     todo!()
         196  +
//! }
         197  +
//!
         198  +
//! async fn r#match(input: input::MatchInput) -> Result<output::MatchOutput, error::MatchError> {
         199  +
//!     todo!()
         200  +
//! }
         201  +
//!
         202  +
//! async fn option(input: input::OptionInput) -> output::OptionOutput {
         203  +
//!     todo!()
         204  +
//! }
         205  +
//!
         206  +
//! async fn reserved_words_as_members(input: input::ReservedWordsAsMembersInput) -> Result<output::ReservedWordsAsMembersOutput, error::ReservedWordsAsMembersError> {
         207  +
//!     todo!()
         208  +
//! }
         209  +
//!
         210  +
//! async fn result(input: input::ResultInput) -> output::ResultOutput {
         211  +
//!     todo!()
         212  +
//! }
         213  +
//!
         214  +
//! async fn rpc_echo(input: input::RpcEchoInput) -> Result<output::RpcEchoOutput, error::RPCEchoError> {
         215  +
//!     todo!()
         216  +
//! }
         217  +
//!
         218  +
//! async fn structure_name_punning(input: input::StructureNamePunningInput) -> output::StructureNamePunningOutput {
         219  +
//!     todo!()
         220  +
//! }
         221  +
//!
         222  +
//! ```
         223  +
//!
         224  +
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         225  +
//! [hyper server]: https://docs.rs/hyper/0.14.26/hyper/server/index.html
         226  +
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
         227  +
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
         228  +
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
         229  +
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         230  +
pub use crate::service::{
         231  +
    Config, ConfigBuilder, ConfigConfig, ConfigConfigBuilder, MissingOperationsError,
         232  +
};
         233  +
         234  +
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
         235  +
pub mod server {
         236  +
    // Re-export all types from the `aws-smithy-http-server` crate.
         237  +
    pub use ::aws_smithy_legacy_http_server::*;
         238  +
}
         239  +
         240  +
/// Crate version number.
         241  +
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
         242  +
         243  +
/// All error types that operations can return. Documentation on these types is copied from the model.
         244  +
pub mod error;
         245  +
         246  +
/// Input structures for operations. Documentation on these types is copied from the model.
         247  +
pub mod input;
         248  +
         249  +
/// Data structures used by operation inputs/outputs. Documentation on these types is copied from the model.
         250  +
pub mod model;
         251  +
         252  +
/// All operations that this crate can perform.
         253  +
pub mod operation;
         254  +
         255  +
/// A collection of types representing each operation defined in the service closure.
         256  +
///
         257  +
/// The [plugin system](::aws_smithy_legacy_http_server::plugin) makes use of these
         258  +
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
         259  +
/// parameterize [`Plugin`](::aws_smithy_legacy_http_server::plugin::Plugin) implementations. Their traits, such as
         260  +
/// [`OperationShape`](::aws_smithy_legacy_http_server::operation::OperationShape), can be used to provide
         261  +
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
         262  +
pub mod operation_shape;
         263  +
         264  +
/// Output structures for operations. Documentation on these types is copied from the model.
         265  +
pub mod output;
         266  +
         267  +
mod service;
         268  +
         269  +
/// Data primitives referenced by other data types.
         270  +
pub mod types;
         271  +
         272  +
/// Constrained types for constrained shapes.
         273  +
mod constrained;
         274  +
         275  +
mod mimes;
         276  +
         277  +
pub(crate) mod protocol_serde;

tmp-codegen-diff/codegen-server-test/naming_test_ops-http0x/rust-server-codegen/src/mimes.rs

@@ -0,1 +0,7 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) static CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1: std::sync::LazyLock<::mime::Mime> =
           3  +
    std::sync::LazyLock::new(|| {
           4  +
        "application/x-amz-json-1.1"
           5  +
            .parse::<::mime::Mime>()
           6  +
            .expect("BUG: MIME parsing failed, content_type is not valid")
           7  +
    });

tmp-codegen-diff/codegen-server-test/naming_test_ops-http0x/rust-server-codegen/src/model.rs

@@ -0,1 +0,277 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
/// Describes one specific validation failure for an input member.
           4  +
#[derive(
           5  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           6  +
)]
           7  +
pub struct ValidationExceptionField {
           8  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
           9  +
    pub path: ::std::string::String,
          10  +
    /// A detailed description of the validation failure.
          11  +
    pub message: ::std::string::String,
          12  +
}
          13  +
impl ValidationExceptionField {
          14  +
    /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
          15  +
    pub fn path(&self) -> &str {
          16  +
        use std::ops::Deref;
          17  +
        self.path.deref()
          18  +
    }
          19  +
    /// A detailed description of the validation failure.
          20  +
    pub fn message(&self) -> &str {
          21  +
        use std::ops::Deref;
          22  +
        self.message.deref()
          23  +
    }
          24  +
}
          25  +
impl ValidationExceptionField {
          26  +
    /// Creates a new builder-style object to manufacture [`ValidationExceptionField`](crate::model::ValidationExceptionField).
          27  +
    pub fn builder() -> crate::model::validation_exception_field::Builder {
          28  +
        crate::model::validation_exception_field::Builder::default()
          29  +
    }
          30  +
}
          31  +
          32  +
///
          33  +
/// _Note: `UnknownVariantCollidingEnum::Self` has been renamed to `::SelfValue`.
          34  +
/// `UnknownVariantCollidingEnum::SelfValue` has been renamed to `::SelfValue_`._
          35  +
#[derive(
          36  +
    ::std::clone::Clone,
          37  +
    ::std::cmp::Eq,
          38  +
    ::std::cmp::Ord,
          39  +
    ::std::cmp::PartialEq,
          40  +
    ::std::cmp::PartialOrd,
          41  +
    ::std::fmt::Debug,
          42  +
    ::std::hash::Hash,
          43  +
)]
          44  +
pub enum UnknownVariantCollidingEnum {
          45  +
    #[allow(missing_docs)] // documentation missing in model
          46  +
    Known,
          47  +
    ///
          48  +
    /// _Note: `::Self` has been renamed to `::SelfValue`._
          49  +
    SelfValue,
          50  +
    ///
          51  +
    /// _Note: `::SelfValue` has been renamed to `::SelfValue_`._
          52  +
    SelfValue_,
          53  +
    #[allow(missing_docs)] // documentation missing in model
          54  +
    Unknown,
          55  +
    #[allow(missing_docs)] // documentation missing in model
          56  +
    UnknownValue,
          57  +
}
          58  +
/// See [`UnknownVariantCollidingEnum`](crate::model::UnknownVariantCollidingEnum).
          59  +
pub mod unknown_variant_colliding_enum {
          60  +
    #[derive(Debug, PartialEq)]
          61  +
    pub struct ConstraintViolation(pub(crate) ::std::string::String);
          62  +
          63  +
    impl ::std::fmt::Display for ConstraintViolation {
          64  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          65  +
            write!(
          66  +
                f,
          67  +
                r#"Value provided for 'crate#UnknownVariantCollidingEnum' failed to satisfy constraint: Member must satisfy enum value set: [Known, Unknown, Self, UnknownValue, SelfValue]"#
          68  +
            )
          69  +
        }
          70  +
    }
          71  +
          72  +
    impl ::std::error::Error for ConstraintViolation {}
          73  +
    impl ConstraintViolation {
          74  +
        pub(crate) fn as_validation_exception_field(
          75  +
            self,
          76  +
            path: ::std::string::String,
          77  +
        ) -> crate::model::ValidationExceptionField {
          78  +
            crate::model::ValidationExceptionField {
          79  +
                message: format!(
          80  +
                    r#"Value at '{}' failed to satisfy constraint: Member must satisfy enum value set: [Known, Unknown, Self, UnknownValue, SelfValue]"#,
          81  +
                    &path
          82  +
                ),
          83  +
                path,
          84  +
            }
          85  +
        }
          86  +
    }
          87  +
}
          88  +
impl ::std::convert::TryFrom<&str> for UnknownVariantCollidingEnum {
          89  +
    type Error = crate::model::unknown_variant_colliding_enum::ConstraintViolation;
          90  +
    fn try_from(
          91  +
        s: &str,
          92  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<&str>>::Error> {
          93  +
        match s {
          94  +
            "Known" => Ok(UnknownVariantCollidingEnum::Known),
          95  +
            "Self" => Ok(UnknownVariantCollidingEnum::SelfValue),
          96  +
            "SelfValue" => Ok(UnknownVariantCollidingEnum::SelfValue_),
          97  +
            "Unknown" => Ok(UnknownVariantCollidingEnum::Unknown),
          98  +
            "UnknownValue" => Ok(UnknownVariantCollidingEnum::UnknownValue),
          99  +
            _ => {
         100  +
                Err(crate::model::unknown_variant_colliding_enum::ConstraintViolation(s.to_owned()))
         101  +
            }
         102  +
        }
         103  +
    }
         104  +
}
         105  +
impl ::std::convert::TryFrom<::std::string::String> for UnknownVariantCollidingEnum {
         106  +
    type Error = crate::model::unknown_variant_colliding_enum::ConstraintViolation;
         107  +
    fn try_from(
         108  +
        s: ::std::string::String,
         109  +
    ) -> ::std::result::Result<Self, <Self as ::std::convert::TryFrom<::std::string::String>>::Error>
         110  +
    {
         111  +
        s.as_str().try_into()
         112  +
    }
         113  +
}
         114  +
impl std::str::FromStr for UnknownVariantCollidingEnum {
         115  +
    type Err = crate::model::unknown_variant_colliding_enum::ConstraintViolation;
         116  +
    fn from_str(s: &str) -> std::result::Result<Self, <Self as std::str::FromStr>::Err> {
         117  +
        Self::try_from(s)
         118  +
    }
         119  +
}
         120  +
impl UnknownVariantCollidingEnum {
         121  +
    /// Returns the `&str` value of the enum member.
         122  +
    pub fn as_str(&self) -> &str {
         123  +
        match self {
         124  +
            UnknownVariantCollidingEnum::Known => "Known",
         125  +
            UnknownVariantCollidingEnum::SelfValue => "Self",
         126  +
            UnknownVariantCollidingEnum::SelfValue_ => "SelfValue",
         127  +
            UnknownVariantCollidingEnum::Unknown => "Unknown",
         128  +
            UnknownVariantCollidingEnum::UnknownValue => "UnknownValue",
         129  +
        }
         130  +
    }
         131  +
    /// Returns all the `&str` representations of the enum members.
         132  +
    pub const fn values() -> &'static [&'static str] {
         133  +
        &["Known", "Self", "SelfValue", "Unknown", "UnknownValue"]
         134  +
    }
         135  +
}
         136  +
impl ::std::convert::AsRef<str> for UnknownVariantCollidingEnum {
         137  +
    fn as_ref(&self) -> &str {
         138  +
        self.as_str()
         139  +
    }
         140  +
}
         141  +
impl crate::constrained::Constrained for UnknownVariantCollidingEnum {
         142  +
    type Unconstrained = ::std::string::String;
         143  +
}
         144  +
         145  +
impl ::std::convert::From<::std::string::String>
         146  +
    for crate::constrained::MaybeConstrained<crate::model::UnknownVariantCollidingEnum>
         147  +
{
         148  +
    fn from(value: ::std::string::String) -> Self {
         149  +
        Self::Unconstrained(value)
         150  +
    }
         151  +
}
         152  +
         153  +
#[allow(missing_docs)] // documentation missing in model
         154  +
#[derive(
         155  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         156  +
)]
         157  +
pub struct Vec {
         158  +
    #[allow(missing_docs)] // documentation missing in model
         159  +
    pub pv_member: ::std::option::Option<bool>,
         160  +
}
         161  +
impl Vec {
         162  +
    #[allow(missing_docs)] // documentation missing in model
         163  +
    pub fn pv_member(&self) -> ::std::option::Option<bool> {
         164  +
        self.pv_member
         165  +
    }
         166  +
}
         167  +
impl Vec {
         168  +
    /// Creates a new builder-style object to manufacture [`Vec`](crate::model::Vec).
         169  +
    pub fn builder() -> crate::model::vec::Builder {
         170  +
        crate::model::vec::Builder::default()
         171  +
    }
         172  +
}
         173  +
impl crate::constrained::Constrained for crate::model::Vec {
         174  +
    type Unconstrained = crate::model::vec::Builder;
         175  +
}
         176  +
/// See [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         177  +
pub mod validation_exception_field {
         178  +
         179  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
         180  +
    /// Holds one variant for each of the ways the builder can fail.
         181  +
    #[non_exhaustive]
         182  +
    #[allow(clippy::enum_variant_names)]
         183  +
    pub enum ConstraintViolation {
         184  +
        /// `path` was not provided but it is required when building `ValidationExceptionField`.
         185  +
        MissingPath,
         186  +
        /// `message` was not provided but it is required when building `ValidationExceptionField`.
         187  +
        MissingMessage,
         188  +
    }
         189  +
    impl ::std::fmt::Display for ConstraintViolation {
         190  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         191  +
            match self {
         192  +
                ConstraintViolation::MissingPath => write!(f, "`path` was not provided but it is required when building `ValidationExceptionField`"),
         193  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationExceptionField`"),
         194  +
            }
         195  +
        }
         196  +
    }
         197  +
    impl ::std::error::Error for ConstraintViolation {}
         198  +
    impl ::std::convert::TryFrom<Builder> for crate::model::ValidationExceptionField {
         199  +
        type Error = ConstraintViolation;
         200  +
         201  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
         202  +
            builder.build()
         203  +
        }
         204  +
    }
         205  +
    /// A builder for [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         206  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         207  +
    pub struct Builder {
         208  +
        pub(crate) path: ::std::option::Option<::std::string::String>,
         209  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
         210  +
    }
         211  +
    impl Builder {
         212  +
        /// A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
         213  +
        pub fn path(mut self, input: ::std::string::String) -> Self {
         214  +
            self.path = Some(input);
         215  +
            self
         216  +
        }
         217  +
        /// A detailed description of the validation failure.
         218  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
         219  +
            self.message = Some(input);
         220  +
            self
         221  +
        }
         222  +
        /// Consumes the builder and constructs a [`ValidationExceptionField`](crate::model::ValidationExceptionField).
         223  +
        ///
         224  +
        /// The builder fails to construct a [`ValidationExceptionField`](crate::model::ValidationExceptionField) if a [`ConstraintViolation`] occurs.
         225  +
        ///
         226  +
        /// If the builder fails, it will return the _first_ encountered [`ConstraintViolation`].
         227  +
        pub fn build(self) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
         228  +
            self.build_enforcing_all_constraints()
         229  +
        }
         230  +
        fn build_enforcing_all_constraints(
         231  +
            self,
         232  +
        ) -> Result<crate::model::ValidationExceptionField, ConstraintViolation> {
         233  +
            Ok(crate::model::ValidationExceptionField {
         234  +
                path: self.path.ok_or(ConstraintViolation::MissingPath)?,
         235  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
         236  +
            })
         237  +
        }
         238  +
    }
         239  +
}
         240  +
/// See [`Vec`](crate::model::Vec).
         241  +
pub mod vec {
         242  +
         243  +
    impl ::std::convert::From<Builder> for crate::model::Vec {
         244  +
        fn from(builder: Builder) -> Self {
         245  +
            builder.build()
         246  +
        }
         247  +
    }
         248  +
    /// A builder for [`Vec`](crate::model::Vec).
         249  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         250  +
    pub struct Builder {
         251  +
        pub(crate) pv_member: ::std::option::Option<bool>,
         252  +
    }
         253  +
    impl Builder {
         254  +
        #[allow(missing_docs)] // documentation missing in model
         255  +
        pub fn pv_member(mut self, input: ::std::option::Option<bool>) -> Self {
         256  +
            self.pv_member = input;
         257  +
            self
         258  +
        }
         259  +
        #[allow(missing_docs)] // documentation missing in model
         260  +
        pub(crate) fn set_pv_member(
         261  +
            mut self,
         262  +
            input: Option<impl ::std::convert::Into<bool>>,
         263  +
        ) -> Self {
         264  +
            self.pv_member = input.map(|v| v.into());
         265  +
            self
         266  +
        }
         267  +
        /// Consumes the builder and constructs a [`Vec`](crate::model::Vec).
         268  +
        pub fn build(self) -> crate::model::Vec {
         269  +
            self.build_enforcing_all_constraints()
         270  +
        }
         271  +
        fn build_enforcing_all_constraints(self) -> crate::model::Vec {
         272  +
            crate::model::Vec {
         273  +
                pv_member: self.pv_member,
         274  +
            }
         275  +
        }
         276  +
    }
         277  +
}

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

@@ -0,1 +0,730 @@
           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  +
    /// [`RpcEchoInput`](crate::input::RpcEchoInput) using modelled bindings.
           5  +
    pub struct RpcEchoInputFuture {
           6  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RpcEchoInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
           7  +
    }
           8  +
}
           9  +
          10  +
impl std::future::Future for RpcEchoInputFuture {
          11  +
    type Output = Result<
          12  +
        crate::input::RpcEchoInput,
          13  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::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::aws_json_11::AwsJson1_1,
          28  +
        B,
          29  +
    > for crate::input::RpcEchoInput
          30  +
where
          31  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
          32  +
    B: 'static,
          33  +
          34  +
    B::Data: Send,
          35  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
          36  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
          37  +
{
          38  +
    type Rejection =
          39  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
          40  +
    type Future = RpcEchoInputFuture;
          41  +
          42  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          43  +
        let fut = async move {
          44  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
          45  +
                request.headers(),
          46  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
          47  +
            ) {
          48  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
          49  +
            }
          50  +
            crate::protocol_serde::shape_rpc_echo::de_rpc_echo_http_request(request).await
          51  +
        };
          52  +
        use ::futures_util::future::TryFutureExt;
          53  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
          54  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
          55  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
          56  +
                    });
          57  +
        RpcEchoInputFuture {
          58  +
            inner: Box::pin(fut),
          59  +
        }
          60  +
    }
          61  +
}
          62  +
impl
          63  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          64  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
          65  +
    > for crate::output::RpcEchoOutput
          66  +
{
          67  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
          68  +
        match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_response(self) {
          69  +
            Ok(response) => response,
          70  +
            Err(e) => {
          71  +
                ::tracing::error!(error = %e, "failed to serialize response");
          72  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
          73  +
            }
          74  +
        }
          75  +
    }
          76  +
}
          77  +
impl
          78  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
          79  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
          80  +
    > for crate::error::RPCEchoError
          81  +
{
          82  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
          83  +
        match crate::protocol_serde::shape_rpc_echo::ser_rpc_echo_http_error(&self) {
          84  +
            Ok(mut response) => {
          85  +
                response.extensions_mut().insert(
          86  +
                    ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
          87  +
                        self.name(),
          88  +
                    ),
          89  +
                );
          90  +
                response
          91  +
            }
          92  +
            Err(e) => {
          93  +
                ::tracing::error!(error = %e, "failed to serialize response");
          94  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
          95  +
            }
          96  +
        }
          97  +
    }
          98  +
}
          99  +
         100  +
::pin_project_lite::pin_project! {
         101  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         102  +
    /// [`MatchInput`](crate::input::MatchInput) using modelled bindings.
         103  +
    pub struct MatchInputFuture {
         104  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MatchInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         105  +
    }
         106  +
}
         107  +
         108  +
impl std::future::Future for MatchInputFuture {
         109  +
    type Output = Result<
         110  +
        crate::input::MatchInput,
         111  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         112  +
    >;
         113  +
         114  +
    fn poll(
         115  +
        self: std::pin::Pin<&mut Self>,
         116  +
        cx: &mut std::task::Context<'_>,
         117  +
    ) -> std::task::Poll<Self::Output> {
         118  +
        let this = self.project();
         119  +
        this.inner.as_mut().poll(cx)
         120  +
    }
         121  +
}
         122  +
         123  +
impl<B>
         124  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         125  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         126  +
        B,
         127  +
    > for crate::input::MatchInput
         128  +
where
         129  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         130  +
    B: 'static,
         131  +
         132  +
    B::Data: Send,
         133  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         134  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         135  +
{
         136  +
    type Rejection =
         137  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         138  +
    type Future = MatchInputFuture;
         139  +
         140  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         141  +
        let fut = async move {
         142  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         143  +
                request.headers(),
         144  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         145  +
            ) {
         146  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         147  +
            }
         148  +
            crate::protocol_serde::shape_match::de_match_http_request(request).await
         149  +
        };
         150  +
        use ::futures_util::future::TryFutureExt;
         151  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         152  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         153  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         154  +
                    });
         155  +
        MatchInputFuture {
         156  +
            inner: Box::pin(fut),
         157  +
        }
         158  +
    }
         159  +
}
         160  +
impl
         161  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         162  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         163  +
    > for crate::output::MatchOutput
         164  +
{
         165  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         166  +
        match crate::protocol_serde::shape_match::ser_match_http_response(self) {
         167  +
            Ok(response) => response,
         168  +
            Err(e) => {
         169  +
                ::tracing::error!(error = %e, "failed to serialize response");
         170  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         171  +
            }
         172  +
        }
         173  +
    }
         174  +
}
         175  +
impl
         176  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         177  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         178  +
    > for crate::error::MatchError
         179  +
{
         180  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         181  +
        match crate::protocol_serde::shape_match::ser_match_http_error(&self) {
         182  +
            Ok(mut response) => {
         183  +
                response.extensions_mut().insert(
         184  +
                    ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
         185  +
                        self.name(),
         186  +
                    ),
         187  +
                );
         188  +
                response
         189  +
            }
         190  +
            Err(e) => {
         191  +
                ::tracing::error!(error = %e, "failed to serialize response");
         192  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         193  +
            }
         194  +
        }
         195  +
    }
         196  +
}
         197  +
         198  +
::pin_project_lite::pin_project! {
         199  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         200  +
    /// [`OptionInput`](crate::input::OptionInput) using modelled bindings.
         201  +
    pub struct OptionInputFuture {
         202  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OptionInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         203  +
    }
         204  +
}
         205  +
         206  +
impl std::future::Future for OptionInputFuture {
         207  +
    type Output = Result<
         208  +
        crate::input::OptionInput,
         209  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         210  +
    >;
         211  +
         212  +
    fn poll(
         213  +
        self: std::pin::Pin<&mut Self>,
         214  +
        cx: &mut std::task::Context<'_>,
         215  +
    ) -> std::task::Poll<Self::Output> {
         216  +
        let this = self.project();
         217  +
        this.inner.as_mut().poll(cx)
         218  +
    }
         219  +
}
         220  +
         221  +
impl<B>
         222  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         223  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         224  +
        B,
         225  +
    > for crate::input::OptionInput
         226  +
where
         227  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         228  +
    B: 'static,
         229  +
         230  +
    B::Data: Send,
         231  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         232  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         233  +
{
         234  +
    type Rejection =
         235  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         236  +
    type Future = OptionInputFuture;
         237  +
         238  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         239  +
        let fut = async move {
         240  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         241  +
                request.headers(),
         242  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         243  +
            ) {
         244  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         245  +
            }
         246  +
            crate::protocol_serde::shape_option::de_option_http_request(request).await
         247  +
        };
         248  +
        use ::futures_util::future::TryFutureExt;
         249  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         250  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         251  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         252  +
                    });
         253  +
        OptionInputFuture {
         254  +
            inner: Box::pin(fut),
         255  +
        }
         256  +
    }
         257  +
}
         258  +
impl
         259  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         260  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         261  +
    > for crate::output::OptionOutput
         262  +
{
         263  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         264  +
        match crate::protocol_serde::shape_option::ser_option_http_response(self) {
         265  +
            Ok(response) => response,
         266  +
            Err(e) => {
         267  +
                ::tracing::error!(error = %e, "failed to serialize response");
         268  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         269  +
            }
         270  +
        }
         271  +
    }
         272  +
}
         273  +
         274  +
::pin_project_lite::pin_project! {
         275  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         276  +
    /// [`ResultInput`](crate::input::ResultInput) using modelled bindings.
         277  +
    pub struct ResultInputFuture {
         278  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ResultInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         279  +
    }
         280  +
}
         281  +
         282  +
impl std::future::Future for ResultInputFuture {
         283  +
    type Output = Result<
         284  +
        crate::input::ResultInput,
         285  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         286  +
    >;
         287  +
         288  +
    fn poll(
         289  +
        self: std::pin::Pin<&mut Self>,
         290  +
        cx: &mut std::task::Context<'_>,
         291  +
    ) -> std::task::Poll<Self::Output> {
         292  +
        let this = self.project();
         293  +
        this.inner.as_mut().poll(cx)
         294  +
    }
         295  +
}
         296  +
         297  +
impl<B>
         298  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         299  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         300  +
        B,
         301  +
    > for crate::input::ResultInput
         302  +
where
         303  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         304  +
    B: 'static,
         305  +
         306  +
    B::Data: Send,
         307  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         308  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         309  +
{
         310  +
    type Rejection =
         311  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         312  +
    type Future = ResultInputFuture;
         313  +
         314  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         315  +
        let fut = async move {
         316  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         317  +
                request.headers(),
         318  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         319  +
            ) {
         320  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         321  +
            }
         322  +
            crate::protocol_serde::shape_result::de_result_http_request(request).await
         323  +
        };
         324  +
        use ::futures_util::future::TryFutureExt;
         325  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         326  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         327  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         328  +
                    });
         329  +
        ResultInputFuture {
         330  +
            inner: Box::pin(fut),
         331  +
        }
         332  +
    }
         333  +
}
         334  +
impl
         335  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         336  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         337  +
    > for crate::output::ResultOutput
         338  +
{
         339  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         340  +
        match crate::protocol_serde::shape_result::ser_result_http_response(self) {
         341  +
            Ok(response) => response,
         342  +
            Err(e) => {
         343  +
                ::tracing::error!(error = %e, "failed to serialize response");
         344  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         345  +
            }
         346  +
        }
         347  +
    }
         348  +
}
         349  +
         350  +
::pin_project_lite::pin_project! {
         351  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         352  +
    /// [`ErrCollisionsInput`](crate::input::ErrCollisionsInput) using modelled bindings.
         353  +
    pub struct ErrCollisionsInputFuture {
         354  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrCollisionsInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         355  +
    }
         356  +
}
         357  +
         358  +
impl std::future::Future for ErrCollisionsInputFuture {
         359  +
    type Output = Result<
         360  +
        crate::input::ErrCollisionsInput,
         361  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         362  +
    >;
         363  +
         364  +
    fn poll(
         365  +
        self: std::pin::Pin<&mut Self>,
         366  +
        cx: &mut std::task::Context<'_>,
         367  +
    ) -> std::task::Poll<Self::Output> {
         368  +
        let this = self.project();
         369  +
        this.inner.as_mut().poll(cx)
         370  +
    }
         371  +
}
         372  +
         373  +
impl<B>
         374  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         375  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         376  +
        B,
         377  +
    > for crate::input::ErrCollisionsInput
         378  +
where
         379  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         380  +
    B: 'static,
         381  +
         382  +
    B::Data: Send,
         383  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         384  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         385  +
{
         386  +
    type Rejection =
         387  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         388  +
    type Future = ErrCollisionsInputFuture;
         389  +
         390  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         391  +
        let fut = async move {
         392  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         393  +
                request.headers(),
         394  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         395  +
            ) {
         396  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         397  +
            }
         398  +
            crate::protocol_serde::shape_err_collisions::de_err_collisions_http_request(request)
         399  +
                .await
         400  +
        };
         401  +
        use ::futures_util::future::TryFutureExt;
         402  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         403  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         404  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         405  +
                    });
         406  +
        ErrCollisionsInputFuture {
         407  +
            inner: Box::pin(fut),
         408  +
        }
         409  +
    }
         410  +
}
         411  +
impl
         412  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         413  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         414  +
    > for crate::output::ErrCollisionsOutput
         415  +
{
         416  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         417  +
        match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_response(self) {
         418  +
            Ok(response) => response,
         419  +
            Err(e) => {
         420  +
                ::tracing::error!(error = %e, "failed to serialize response");
         421  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         422  +
            }
         423  +
        }
         424  +
    }
         425  +
}
         426  +
impl
         427  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         428  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         429  +
    > for crate::error::ErrCollisionsError
         430  +
{
         431  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         432  +
        match crate::protocol_serde::shape_err_collisions::ser_err_collisions_http_error(&self) {
         433  +
            Ok(mut response) => {
         434  +
                response.extensions_mut().insert(
         435  +
                    ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
         436  +
                        self.name(),
         437  +
                    ),
         438  +
                );
         439  +
                response
         440  +
            }
         441  +
            Err(e) => {
         442  +
                ::tracing::error!(error = %e, "failed to serialize response");
         443  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         444  +
            }
         445  +
        }
         446  +
    }
         447  +
}
         448  +
         449  +
::pin_project_lite::pin_project! {
         450  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         451  +
    /// [`StructureNamePunningInput`](crate::input::StructureNamePunningInput) using modelled bindings.
         452  +
    pub struct StructureNamePunningInputFuture {
         453  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StructureNamePunningInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         454  +
    }
         455  +
}
         456  +
         457  +
impl std::future::Future for StructureNamePunningInputFuture {
         458  +
    type Output = Result<
         459  +
        crate::input::StructureNamePunningInput,
         460  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         461  +
    >;
         462  +
         463  +
    fn poll(
         464  +
        self: std::pin::Pin<&mut Self>,
         465  +
        cx: &mut std::task::Context<'_>,
         466  +
    ) -> std::task::Poll<Self::Output> {
         467  +
        let this = self.project();
         468  +
        this.inner.as_mut().poll(cx)
         469  +
    }
         470  +
}
         471  +
         472  +
impl<B>
         473  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         474  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         475  +
        B,
         476  +
    > for crate::input::StructureNamePunningInput
         477  +
where
         478  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         479  +
    B: 'static,
         480  +
         481  +
    B::Data: Send,
         482  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         483  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         484  +
{
         485  +
    type Rejection =
         486  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         487  +
    type Future = StructureNamePunningInputFuture;
         488  +
         489  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         490  +
        let fut = async move {
         491  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         492  +
                request.headers(),
         493  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         494  +
            ) {
         495  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         496  +
            }
         497  +
            crate::protocol_serde::shape_structure_name_punning::de_structure_name_punning_http_request(request)
         498  +
                            .await
         499  +
        };
         500  +
        use ::futures_util::future::TryFutureExt;
         501  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         502  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         503  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         504  +
                    });
         505  +
        StructureNamePunningInputFuture {
         506  +
            inner: Box::pin(fut),
         507  +
        }
         508  +
    }
         509  +
}
         510  +
impl
         511  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         512  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         513  +
    > for crate::output::StructureNamePunningOutput
         514  +
{
         515  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         516  +
        match crate::protocol_serde::shape_structure_name_punning::ser_structure_name_punning_http_response(self) {
         517  +
                        Ok(response) => response,
         518  +
                        Err(e) => {
         519  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         520  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         521  +
                        }
         522  +
                    }
         523  +
    }
         524  +
}
         525  +
         526  +
#[allow(unreachable_code, unused_variables)]
         527  +
#[cfg(test)]
         528  +
mod structure_name_punning_test {
         529  +
         530  +
    /// Test ID: structure_punning
         531  +
    #[::tokio::test]
         532  +
    #[::tracing_test::traced_test]
         533  +
    async fn structure_punning_request() {
         534  +
        #[allow(unused_mut)]
         535  +
        let mut http_request = ::http::Request::builder()
         536  +
            .uri("/")
         537  +
            .method("POST")
         538  +
            .header("Content-Type", "application/x-amz-json-1.1")
         539  +
            .header("X-Amz-Target", "Config.StructureNamePunning")
         540  +
            .body(::aws_smithy_legacy_http_server::body::Body::from(
         541  +
                ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
         542  +
                    "{\"regular_string\": \"hello!\"}".as_bytes(),
         543  +
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
         544  +
                )),
         545  +
            ))
         546  +
            .unwrap();
         547  +
        #[allow(unused_mut)]
         548  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         549  +
        let config = crate::service::ConfigConfig::builder().build();
         550  +
        let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
         551  +
            .structure_name_punning(move |input: crate::input::StructureNamePunningInput| {
         552  +
                let sender = sender.clone();
         553  +
                async move {
         554  +
                    let result = {
         555  +
                        let expected = crate::input::StructureNamePunningInput {
         556  +
                            regular_string: ::std::option::Option::Some("hello!".to_owned()),
         557  +
                            punned_vec: ::std::option::Option::None,
         558  +
                        };
         559  +
                        ::pretty_assertions::assert_eq!(input, expected);
         560  +
                        let output = crate::output::StructureNamePunningOutput {};
         561  +
                        output
         562  +
                    };
         563  +
                    sender.send(()).await.expect("receiver dropped early");
         564  +
                    result
         565  +
                }
         566  +
            })
         567  +
            .build_unchecked();
         568  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         569  +
            .await
         570  +
            .expect("unable to make an HTTP request");
         571  +
        assert!(
         572  +
            receiver.recv().await.is_some(),
         573  +
            "we expected operation handler to be invoked but it was not entered"
         574  +
        );
         575  +
    }
         576  +
}
         577  +
         578  +
::pin_project_lite::pin_project! {
         579  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
         580  +
    /// [`ReservedWordsAsMembersInput`](crate::input::ReservedWordsAsMembersInput) using modelled bindings.
         581  +
    pub struct ReservedWordsAsMembersInputFuture {
         582  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ReservedWordsAsMembersInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
         583  +
    }
         584  +
}
         585  +
         586  +
impl std::future::Future for ReservedWordsAsMembersInputFuture {
         587  +
    type Output = Result<
         588  +
        crate::input::ReservedWordsAsMembersInput,
         589  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError,
         590  +
    >;
         591  +
         592  +
    fn poll(
         593  +
        self: std::pin::Pin<&mut Self>,
         594  +
        cx: &mut std::task::Context<'_>,
         595  +
    ) -> std::task::Poll<Self::Output> {
         596  +
        let this = self.project();
         597  +
        this.inner.as_mut().poll(cx)
         598  +
    }
         599  +
}
         600  +
         601  +
impl<B>
         602  +
    ::aws_smithy_legacy_http_server::request::FromRequest<
         603  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         604  +
        B,
         605  +
    > for crate::input::ReservedWordsAsMembersInput
         606  +
where
         607  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
         608  +
    B: 'static,
         609  +
         610  +
    B::Data: Send,
         611  +
    ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection:
         612  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
         613  +
{
         614  +
    type Rejection =
         615  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError;
         616  +
    type Future = ReservedWordsAsMembersInputFuture;
         617  +
         618  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         619  +
        let fut = async move {
         620  +
            if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
         621  +
                request.headers(),
         622  +
                &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
         623  +
            ) {
         624  +
                return Err(::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
         625  +
            }
         626  +
            crate::protocol_serde::shape_reserved_words_as_members::de_reserved_words_as_members_http_request(request)
         627  +
                            .await
         628  +
        };
         629  +
        use ::futures_util::future::TryFutureExt;
         630  +
        let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::aws_json::rejection::RequestRejection| {
         631  +
                        ::tracing::debug!(error = %e, "failed to deserialize request");
         632  +
                        ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
         633  +
                    });
         634  +
        ReservedWordsAsMembersInputFuture {
         635  +
            inner: Box::pin(fut),
         636  +
        }
         637  +
    }
         638  +
}
         639  +
impl
         640  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         641  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         642  +
    > for crate::output::ReservedWordsAsMembersOutput
         643  +
{
         644  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         645  +
        match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_response(self) {
         646  +
                        Ok(response) => response,
         647  +
                        Err(e) => {
         648  +
                            ::tracing::error!(error = %e, "failed to serialize response");
         649  +
                            ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         650  +
                        }
         651  +
                    }
         652  +
    }
         653  +
}
         654  +
impl
         655  +
    ::aws_smithy_legacy_http_server::response::IntoResponse<
         656  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         657  +
    > for crate::error::ReservedWordsAsMembersError
         658  +
{
         659  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
         660  +
        match crate::protocol_serde::shape_reserved_words_as_members::ser_reserved_words_as_members_http_error(&self) {
         661  +
            Ok(mut response) => {
         662  +
                response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
         663  +
                response
         664  +
            },
         665  +
            Err(e) => {
         666  +
                ::tracing::error!(error = %e, "failed to serialize response");
         667  +
                ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
         668  +
            }
         669  +
        }
         670  +
    }
         671  +
}
         672  +
         673  +
#[allow(unreachable_code, unused_variables)]
         674  +
#[cfg(test)]
         675  +
mod reserved_words_as_members_test {
         676  +
         677  +
    /// Test ID: reserved_words
         678  +
    #[::tokio::test]
         679  +
    #[::tracing_test::traced_test]
         680  +
    async fn reserved_words_request() {
         681  +
        #[allow(unused_mut)]
         682  +
        let mut http_request = ::http::Request::builder()
         683  +
            .uri("/")
         684  +
            .method("POST")
         685  +
            .header("Content-Type", "application/x-amz-json-1.1")
         686  +
            .header("X-Amz-Target", "Config.ReservedWordsAsMembers")
         687  +
            .body(::aws_smithy_legacy_http_server::body::Body::from(
         688  +
                ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
         689  +
                    "{\"as\": 5, \"async\": true}".as_bytes(),
         690  +
                    ::aws_smithy_protocol_test::MediaType::from("application/json"),
         691  +
                )),
         692  +
            ))
         693  +
            .unwrap();
         694  +
        #[allow(unused_mut)]
         695  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         696  +
        let config = crate::service::ConfigConfig::builder().build();
         697  +
        let service = crate::service::Config::builder::<::hyper::body::Body, _, _, _>(config)
         698  +
            .reserved_words_as_members(move |input: crate::input::ReservedWordsAsMembersInput| {
         699  +
                let sender = sender.clone();
         700  +
                async move {
         701  +
                    let result = {
         702  +
                        let expected = crate::input::ReservedWordsAsMembersInput {
         703  +
                            r#as: ::std::option::Option::Some(5),
         704  +
                            r#async: ::std::option::Option::Some(true),
         705  +
                            r#enum: ::std::option::Option::None,
         706  +
                            self_: ::std::option::Option::None,
         707  +
                            crate_: ::std::option::Option::None,
         708  +
                            super_: ::std::option::Option::None,
         709  +
                            build_value: ::std::option::Option::None,
         710  +
                            default_value: ::std::option::Option::None,
         711  +
                            send: ::std::option::Option::None,
         712  +
                        };
         713  +
                        ::pretty_assertions::assert_eq!(input, expected);
         714  +
                        let output = crate::output::ReservedWordsAsMembersOutput {};
         715  +
                        Ok(output)
         716  +
                    };
         717  +
                    sender.send(()).await.expect("receiver dropped early");
         718  +
                    result
         719  +
                }
         720  +
            })
         721  +
            .build_unchecked();
         722  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         723  +
            .await
         724  +
            .expect("unable to make an HTTP request");
         725  +
        assert!(
         726  +
            receiver.recv().await.is_some(),
         727  +
            "we expected operation handler to be invoked but it was not entered"
         728  +
        );
         729  +
    }
         730  +
}