Server Test

Server Test

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -0,1 +0,245 @@
           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 casing
          23  +
          24  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
          25  +
//! A fast and customizable Rust implementation of the AcronymInsideService Smithy service.
          26  +
//!
          27  +
//! # Using AcronymInsideService
          28  +
//!
          29  +
//! The primary entrypoint is [`AcronymInsideService`]: 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 [`AcronymInsideService::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`], and [`crate::output`],
          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_casing_http0x::{AcronymInsideService, AcronymInsideServiceConfig};
          49  +
//!
          50  +
//! # let app = AcronymInsideService::builder(
          51  +
//! #     AcronymInsideServiceConfig::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_casing_http0x::server::routing::LambdaHandler;
          66  +
//! use naming_test_casing_http0x::AcronymInsideService;
          67  +
//!
          68  +
//! # async fn dummy() {
          69  +
//! # let app = AcronymInsideService::builder(
          70  +
//! #     AcronymInsideServiceConfig::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 AcronymInsideService
          79  +
//!
          80  +
//! To construct [`AcronymInsideService`] we use [`AcronymInsideServiceBuilder`] returned by [`AcronymInsideService::builder`].
          81  +
//!
          82  +
//! ## Plugins
          83  +
//!
          84  +
//! The [`AcronymInsideService::builder`] method, returning [`AcronymInsideServiceBuilder`],
          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_casing_http0x::server::plugin::IdentityPlugin as LoggingPlugin;
          90  +
//! # use naming_test_casing_http0x::server::plugin::IdentityPlugin as MetricsPlugin;
          91  +
//! # use ::hyper::Body;
          92  +
//! use naming_test_casing_http0x::server::plugin::HttpPlugins;
          93  +
//! use naming_test_casing_http0x::{AcronymInsideService, AcronymInsideServiceConfig, AcronymInsideServiceBuilder};
          94  +
//!
          95  +
//! let http_plugins = HttpPlugins::new()
          96  +
//!         .push(LoggingPlugin)
          97  +
//!         .push(MetricsPlugin);
          98  +
//! let config = AcronymInsideServiceConfig::builder().build();
          99  +
//! let builder: AcronymInsideServiceBuilder<::hyper::Body, _, _, _> = AcronymInsideService::builder(config);
         100  +
//! ```
         101  +
//!
         102  +
//! Check out [`crate::server::plugin`] to learn more about plugins.
         103  +
//!
         104  +
//! ## Handlers
         105  +
//!
         106  +
//! [`AcronymInsideServiceBuilder`] 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_casing_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 [`AcronymInsideServiceBuilder`] into [`AcronymInsideService`] using either [`AcronymInsideServiceBuilder::build`] or [`AcronymInsideServiceBuilder::build_unchecked`].
         155  +
//!
         156  +
//! [`AcronymInsideServiceBuilder::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  +
//! [`AcronymInsideServiceBuilder::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  +
//! [`AcronymInsideServiceBuilder::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_casing_http0x::{AcronymInsideService, AcronymInsideServiceConfig};
         166  +
//!
         167  +
//! #[::tokio::main]
         168  +
//! pub async fn main() {
         169  +
//!    let config = AcronymInsideServiceConfig::builder().build();
         170  +
//!    let app = AcronymInsideService::builder(config)
         171  +
//!        .do_nothing(do_nothing)
         172  +
//!        .build()
         173  +
//!        .expect("failed to build an instance of AcronymInsideService");
         174  +
//!
         175  +
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
         176  +
//!        .expect("unable to parse the server bind address and port");
         177  +
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
         178  +
//!    # let server = async { Ok::<_, ()>(()) };
         179  +
//!
         180  +
//!    // Run your service!
         181  +
//!    if let Err(err) = server.await {
         182  +
//!        eprintln!("server error: {:?}", err);
         183  +
//!    }
         184  +
//! }
         185  +
//!
         186  +
//! use naming_test_casing_http0x::{input, output};
         187  +
//!
         188  +
//! async fn do_nothing(input: input::DoNothingInput) -> output::DoNothingOutput {
         189  +
//!     todo!()
         190  +
//! }
         191  +
//!
         192  +
//! ```
         193  +
//!
         194  +
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         195  +
//! [hyper server]: https://docs.rs/hyper/0.14.26/hyper/server/index.html
         196  +
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
         197  +
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
         198  +
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
         199  +
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         200  +
pub use crate::service::{
         201  +
    AcronymInsideService, AcronymInsideServiceBuilder, AcronymInsideServiceConfig,
         202  +
    AcronymInsideServiceConfigBuilder, MissingOperationsError,
         203  +
};
         204  +
         205  +
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
         206  +
pub mod server {
         207  +
    // Re-export all types from the `aws-smithy-http-server` crate.
         208  +
    pub use ::aws_smithy_legacy_http_server::*;
         209  +
}
         210  +
         211  +
/// Crate version number.
         212  +
pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
         213  +
         214  +
/// All error types that operations can return. Documentation on these types is copied from the model.
         215  +
pub mod error;
         216  +
         217  +
/// Input structures for operations. Documentation on these types is copied from the model.
         218  +
pub mod input;
         219  +
         220  +
/// All operations that this crate can perform.
         221  +
pub mod operation;
         222  +
         223  +
/// A collection of types representing each operation defined in the service closure.
         224  +
///
         225  +
/// The [plugin system](::aws_smithy_legacy_http_server::plugin) makes use of these
         226  +
/// [zero-sized types](https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) (ZSTs) to
         227  +
/// parameterize [`Plugin`](::aws_smithy_legacy_http_server::plugin::Plugin) implementations. Their traits, such as
         228  +
/// [`OperationShape`](::aws_smithy_legacy_http_server::operation::OperationShape), can be used to provide
         229  +
/// operation specific information to the [`Layer`](::tower::Layer) being applied.
         230  +
pub mod operation_shape;
         231  +
         232  +
/// Output structures for operations. Documentation on these types is copied from the model.
         233  +
pub mod output;
         234  +
         235  +
mod service;
         236  +
         237  +
/// Data primitives referenced by other data types.
         238  +
pub mod types;
         239  +
         240  +
/// Constrained types for constrained shapes.
         241  +
mod constrained;
         242  +
         243  +
mod mimes;
         244  +
         245  +
pub(crate) mod protocol_serde;

tmp-codegen-diff/codegen-server-test/naming_test_casing-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_casing-http0x/rust-server-codegen/src/operation.rs

@@ -0,1 +0,76 @@
           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  +
    /// [`DoNothingInput`](crate::input::DoNothingInput) using modelled bindings.
           5  +
    pub struct DoNothingInputFuture {
           6  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DoNothingInput, ::aws_smithy_legacy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
           7  +
    }
           8  +
}
           9  +
          10  +
impl std::future::Future for DoNothingInputFuture {
          11  +
    type Output = Result<
          12  +
        crate::input::DoNothingInput,
          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::DoNothingInput
          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 = DoNothingInputFuture;
          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_do_nothing::de_do_nothing_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  +
        DoNothingInputFuture {
          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::DoNothingOutput
          66  +
{
          67  +
    fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
          68  +
        match crate::protocol_serde::shape_do_nothing::ser_do_nothing_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  +
}

tmp-codegen-diff/codegen-server-test/naming_test_casing-http0x/rust-server-codegen/src/operation_shape.rs

@@ -0,1 +0,31 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
pub struct DoNothing;
           4  +
           5  +
impl ::aws_smithy_legacy_http_server::operation::OperationShape for DoNothing {
           6  +
    const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
           7  +
        ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
           8  +
            "casing#DoNothing",
           9  +
            "casing",
          10  +
            "DoNothing",
          11  +
        );
          12  +
          13  +
    type Input = crate::input::DoNothingInput;
          14  +
    type Output = crate::output::DoNothingOutput;
          15  +
    type Error = std::convert::Infallible;
          16  +
}
          17  +
          18  +
impl ::aws_smithy_legacy_http_server::instrumentation::sensitivity::Sensitivity for DoNothing {
          19  +
    type RequestFmt =
          20  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::DefaultRequestFmt;
          21  +
    type ResponseFmt =
          22  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::DefaultResponseFmt;
          23  +
          24  +
    fn request_fmt() -> Self::RequestFmt {
          25  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::RequestFmt::new()
          26  +
    }
          27  +
          28  +
    fn response_fmt() -> Self::ResponseFmt {
          29  +
        ::aws_smithy_legacy_http_server::instrumentation::sensitivity::ResponseFmt::new()
          30  +
    }
          31  +
}

tmp-codegen-diff/codegen-server-test/naming_test_casing-http0x/rust-server-codegen/src/output.rs

@@ -0,1 +0,33 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
#[allow(missing_docs)] // documentation missing in model
           3  +
#[derive(
           4  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
           5  +
)]
           6  +
pub struct DoNothingOutput {}
           7  +
impl DoNothingOutput {
           8  +
    /// Creates a new builder-style object to manufacture [`DoNothingOutput`](crate::output::DoNothingOutput).
           9  +
    pub fn builder() -> crate::output::do_nothing_output::Builder {
          10  +
        crate::output::do_nothing_output::Builder::default()
          11  +
    }
          12  +
}
          13  +
/// See [`DoNothingOutput`](crate::output::DoNothingOutput).
          14  +
pub mod do_nothing_output {
          15  +
          16  +
    impl ::std::convert::From<Builder> for crate::output::DoNothingOutput {
          17  +
        fn from(builder: Builder) -> Self {
          18  +
            builder.build()
          19  +
        }
          20  +
    }
          21  +
    /// A builder for [`DoNothingOutput`](crate::output::DoNothingOutput).
          22  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
          23  +
    pub struct Builder {}
          24  +
    impl Builder {
          25  +
        /// Consumes the builder and constructs a [`DoNothingOutput`](crate::output::DoNothingOutput).
          26  +
        pub fn build(self) -> crate::output::DoNothingOutput {
          27  +
            self.build_enforcing_all_constraints()
          28  +
        }
          29  +
        fn build_enforcing_all_constraints(self) -> crate::output::DoNothingOutput {
          30  +
            crate::output::DoNothingOutput {}
          31  +
        }
          32  +
    }
          33  +
}

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

@@ -0,1 +0,2 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) mod shape_do_nothing;

tmp-codegen-diff/codegen-server-test/naming_test_casing-http0x/rust-server-codegen/src/protocol_serde/shape_do_nothing.rs

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

tmp-codegen-diff/codegen-server-test/naming_test_casing-http0x/rust-server-codegen/src/service.rs

@@ -0,1 +0,722 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// The service builder for [`AcronymInsideService`].
           3  +
///
           4  +
/// Constructed via [`AcronymInsideService::builder`].
           5  +
pub struct AcronymInsideServiceBuilder<Body, L, HttpPl, ModelPl> {
           6  +
    do_nothing: Option<::aws_smithy_legacy_http_server::routing::Route<Body>>,
           7  +
    layer: L,
           8  +
    http_plugin: HttpPl,
           9  +
    model_plugin: ModelPl,
          10  +
}
          11  +
          12  +
impl<Body, L, HttpPl, ModelPl> AcronymInsideServiceBuilder<Body, L, HttpPl, ModelPl> {
          13  +
    /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) operation.
          14  +
    ///
          15  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
          16  +
    /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
          17  +
    ///
          18  +
    /// # Example
          19  +
    ///
          20  +
    /// ```no_run
          21  +
    /// use naming_test_casing_http0x::{AcronymInsideService, AcronymInsideServiceConfig};
          22  +
    ///
          23  +
    /// use naming_test_casing_http0x::{input, output};
          24  +
    ///
          25  +
    /// async fn handler(input: input::DoNothingInput) -> output::DoNothingOutput {
          26  +
    ///     todo!()
          27  +
    /// }
          28  +
    ///
          29  +
    /// let config = AcronymInsideServiceConfig::builder().build();
          30  +
    /// let app = AcronymInsideService::builder(config)
          31  +
    ///     .do_nothing(handler)
          32  +
    ///     /* Set other handlers */
          33  +
    ///     .build()
          34  +
    ///     .unwrap();
          35  +
    /// # let app: AcronymInsideService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
          36  +
    /// ```
          37  +
    ///
          38  +
                    pub fn do_nothing<HandlerType, HandlerExtractors, UpgradeExtractors>(self, handler: HandlerType) -> Self
          39  +
                    where
          40  +
                        HandlerType: ::aws_smithy_legacy_http_server::operation::Handler<crate::operation_shape::DoNothing, HandlerExtractors>,
          41  +
          42  +
                        ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
          43  +
                            AcronymInsideService<L>,
          44  +
                            crate::operation_shape::DoNothing,
          45  +
                            ::aws_smithy_legacy_http_server::operation::IntoService<crate::operation_shape::DoNothing, HandlerType>
          46  +
                        >,
          47  +
                        ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
          48  +
                            AcronymInsideService<L>,
          49  +
                            crate::operation_shape::DoNothing,
          50  +
                            ModelPl::Output
          51  +
                        >,
          52  +
                        HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
          53  +
                            AcronymInsideService<L>,
          54  +
                            crate::operation_shape::DoNothing,
          55  +
                            <
          56  +
                                ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
          57  +
                                as ::aws_smithy_legacy_http_server::plugin::Plugin<
          58  +
                                    AcronymInsideService<L>,
          59  +
                                    crate::operation_shape::DoNothing,
          60  +
                                    ModelPl::Output
          61  +
                                >
          62  +
                            >::Output
          63  +
                        >,
          64  +
          65  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
          66  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
          67  +
          68  +
                    {
          69  +
        use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
          70  +
        use ::aws_smithy_legacy_http_server::plugin::Plugin;
          71  +
        let svc = crate::operation_shape::DoNothing::from_handler(handler);
          72  +
        let svc = self.model_plugin.apply(svc);
          73  +
        let svc =
          74  +
            ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
          75  +
                .apply(svc);
          76  +
        let svc = self.http_plugin.apply(svc);
          77  +
        self.do_nothing_custom(svc)
          78  +
    }
          79  +
          80  +
    /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) operation.
          81  +
    ///
          82  +
    /// This should be an async function satisfying the [`Handler`](::aws_smithy_legacy_http_server::operation::Handler) trait.
          83  +
    /// See the [operation module documentation](::aws_smithy_legacy_http_server::operation) for more information.
          84  +
    ///
          85  +
    /// # Example
          86  +
    ///
          87  +
    /// ```no_run
          88  +
    /// use naming_test_casing_http0x::{AcronymInsideService, AcronymInsideServiceConfig};
          89  +
    ///
          90  +
    /// use naming_test_casing_http0x::{input, output};
          91  +
    ///
          92  +
    /// async fn handler(input: input::DoNothingInput) -> Result<output::DoNothingOutput, std::convert::Infallible> {
          93  +
    ///     todo!()
          94  +
    /// }
          95  +
    ///
          96  +
    /// let config = AcronymInsideServiceConfig::builder().build();
          97  +
    /// let svc = ::tower::util::service_fn(handler);
          98  +
    /// let app = AcronymInsideService::builder(config)
          99  +
    ///     .do_nothing_service(svc)
         100  +
    ///     /* Set other handlers */
         101  +
    ///     .build()
         102  +
    ///     .unwrap();
         103  +
    /// # let app: AcronymInsideService<::aws_smithy_legacy_http_server::routing::RoutingService<::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<::aws_smithy_legacy_http_server::routing::Route>, ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1>> = app;
         104  +
    /// ```
         105  +
    ///
         106  +
                    pub fn do_nothing_service<S, ServiceExtractors, UpgradeExtractors>(self, service: S) -> Self
         107  +
                    where
         108  +
                        S: ::aws_smithy_legacy_http_server::operation::OperationService<crate::operation_shape::DoNothing, ServiceExtractors>,
         109  +
         110  +
                        ModelPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
         111  +
                            AcronymInsideService<L>,
         112  +
                            crate::operation_shape::DoNothing,
         113  +
                            ::aws_smithy_legacy_http_server::operation::Normalize<crate::operation_shape::DoNothing, S>
         114  +
                        >,
         115  +
                        ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>: ::aws_smithy_legacy_http_server::plugin::Plugin<
         116  +
                            AcronymInsideService<L>,
         117  +
                            crate::operation_shape::DoNothing,
         118  +
                            ModelPl::Output
         119  +
                        >,
         120  +
                        HttpPl: ::aws_smithy_legacy_http_server::plugin::Plugin<
         121  +
                            AcronymInsideService<L>,
         122  +
                            crate::operation_shape::DoNothing,
         123  +
                            <
         124  +
                                ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>
         125  +
                                as ::aws_smithy_legacy_http_server::plugin::Plugin<
         126  +
                                    AcronymInsideService<L>,
         127  +
                                    crate::operation_shape::DoNothing,
         128  +
                                    ModelPl::Output
         129  +
                                >
         130  +
                            >::Output
         131  +
                        >,
         132  +
         133  +
                        HttpPl::Output: ::tower::Service<::http::Request<Body>, Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>, Error = ::std::convert::Infallible> + Clone + Send + 'static,
         134  +
                        <HttpPl::Output as ::tower::Service<::http::Request<Body>>>::Future: Send + 'static,
         135  +
         136  +
                    {
         137  +
        use ::aws_smithy_legacy_http_server::operation::OperationShapeExt;
         138  +
        use ::aws_smithy_legacy_http_server::plugin::Plugin;
         139  +
        let svc = crate::operation_shape::DoNothing::from_service(service);
         140  +
        let svc = self.model_plugin.apply(svc);
         141  +
        let svc =
         142  +
            ::aws_smithy_legacy_http_server::operation::UpgradePlugin::<UpgradeExtractors>::new()
         143  +
                .apply(svc);
         144  +
        let svc = self.http_plugin.apply(svc);
         145  +
        self.do_nothing_custom(svc)
         146  +
    }
         147  +
         148  +
    /// Sets the [`DoNothing`](crate::operation_shape::DoNothing) to a custom [`Service`](tower::Service).
         149  +
    /// not constrained by the Smithy contract.
         150  +
    fn do_nothing_custom<S>(mut self, svc: S) -> Self
         151  +
    where
         152  +
        S: ::tower::Service<
         153  +
                ::http::Request<Body>,
         154  +
                Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
         155  +
                Error = ::std::convert::Infallible,
         156  +
            > + Clone
         157  +
            + Send
         158  +
            + 'static,
         159  +
        S::Future: Send + 'static,
         160  +
    {
         161  +
        self.do_nothing = Some(::aws_smithy_legacy_http_server::routing::Route::new(svc));
         162  +
        self
         163  +
    }
         164  +
}
         165  +
         166  +
impl<Body, L, HttpPl, ModelPl> AcronymInsideServiceBuilder<Body, L, HttpPl, ModelPl> {
         167  +
    /// Constructs a [`AcronymInsideService`] from the arguments provided to the builder.
         168  +
    ///
         169  +
    /// Forgetting to register a handler for one or more operations will result in an error.
         170  +
    ///
         171  +
    /// Check out [`AcronymInsideServiceBuilder::build_unchecked`] if you'd prefer the service to return status code 500 when an
         172  +
    /// unspecified route is requested.
         173  +
    pub fn build(
         174  +
        self,
         175  +
    ) -> ::std::result::Result<
         176  +
        AcronymInsideService<
         177  +
            ::aws_smithy_legacy_http_server::routing::RoutingService<
         178  +
                ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
         179  +
                    L::Service,
         180  +
                >,
         181  +
                ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         182  +
            >,
         183  +
        >,
         184  +
        MissingOperationsError,
         185  +
    >
         186  +
    where
         187  +
        L: ::tower::Layer<::aws_smithy_legacy_http_server::routing::Route<Body>>,
         188  +
    {
         189  +
        let router = {
         190  +
            use ::aws_smithy_legacy_http_server::operation::OperationShape;
         191  +
            let mut missing_operation_names = std::collections::HashMap::new();
         192  +
            if self.do_nothing.is_none() {
         193  +
                missing_operation_names
         194  +
                    .insert(crate::operation_shape::DoNothing::ID, ".do_nothing()");
         195  +
            }
         196  +
            if !missing_operation_names.is_empty() {
         197  +
                return Err(MissingOperationsError {
         198  +
                    operation_names2setter_methods: missing_operation_names,
         199  +
                });
         200  +
            }
         201  +
            let unexpected_error_msg = "this should never panic since we are supposed to check beforehand that a handler has been registered for this operation; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues";
         202  +
         203  +
            ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter([
         204  +
                (
         205  +
                    request_specs::do_nothing(),
         206  +
                    self.do_nothing.expect(unexpected_error_msg),
         207  +
                ),
         208  +
            ])
         209  +
        };
         210  +
        let svc = ::aws_smithy_legacy_http_server::routing::RoutingService::new(router);
         211  +
        let svc = svc.map(|s| s.layer(self.layer));
         212  +
        Ok(AcronymInsideService { svc })
         213  +
    }
         214  +
         215  +
    /// Constructs a [`AcronymInsideService`] from the arguments provided to the builder.
         216  +
    /// Operations without a handler default to returning 500 Internal Server Error to the caller.
         217  +
    ///
         218  +
    /// Check out [`AcronymInsideServiceBuilder::build`] if you'd prefer the builder to fail if one or more operations do
         219  +
    /// not have a registered handler.
         220  +
    pub fn build_unchecked(self) -> AcronymInsideService<L::Service>
         221  +
    where
         222  +
        Body: Send + 'static,
         223  +
        L: ::tower::Layer<
         224  +
            ::aws_smithy_legacy_http_server::routing::RoutingService<
         225  +
                ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
         226  +
                    ::aws_smithy_legacy_http_server::routing::Route<Body>,
         227  +
                >,
         228  +
                ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         229  +
            >,
         230  +
        >,
         231  +
    {
         232  +
        let router =
         233  +
            ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter::from_iter(
         234  +
                [(
         235  +
                    request_specs::do_nothing(),
         236  +
                    self.do_nothing.unwrap_or_else(|| {
         237  +
                        let svc = ::aws_smithy_legacy_http_server::operation::MissingFailure::<
         238  +
                            ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         239  +
                        >::default();
         240  +
                        ::aws_smithy_legacy_http_server::routing::Route::new(svc)
         241  +
                    }),
         242  +
                )],
         243  +
            );
         244  +
        let svc = self
         245  +
            .layer
         246  +
            .layer(::aws_smithy_legacy_http_server::routing::RoutingService::new(router));
         247  +
        AcronymInsideService { svc }
         248  +
    }
         249  +
}
         250  +
         251  +
/// The error encountered when calling the [`AcronymInsideServiceBuilder::build`] method if one or more operation handlers are not
         252  +
/// specified.
         253  +
#[derive(Debug)]
         254  +
pub struct MissingOperationsError {
         255  +
    operation_names2setter_methods:
         256  +
        std::collections::HashMap<::aws_smithy_legacy_http_server::shape_id::ShapeId, &'static str>,
         257  +
}
         258  +
         259  +
impl std::fmt::Display for MissingOperationsError {
         260  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         261  +
        write!(
         262  +
            f,
         263  +
            "You must specify a handler for all operations attached to `AcronymInsideService`.\n\
         264  +
                            We are missing handlers for the following operations:\n",
         265  +
        )?;
         266  +
        for operation_name in self.operation_names2setter_methods.keys() {
         267  +
            writeln!(f, "- {}", operation_name.absolute())?;
         268  +
        }
         269  +
         270  +
        writeln!(f, "\nUse the dedicated methods on `AcronymInsideServiceBuilder` to register the missing handlers:")?;
         271  +
        for setter_name in self.operation_names2setter_methods.values() {
         272  +
            writeln!(f, "- {}", setter_name)?;
         273  +
        }
         274  +
        Ok(())
         275  +
    }
         276  +
}
         277  +
         278  +
impl std::error::Error for MissingOperationsError {}
         279  +
         280  +
mod request_specs {
         281  +
    pub(super) fn do_nothing() -> &'static str {
         282  +
        "ACRONYMInside_Service.DoNothing"
         283  +
    }
         284  +
}
         285  +
         286  +
/// Confounds model generation machinery with lots of problematic casing
         287  +
///
         288  +
/// See the [root](crate) documentation for more information.
         289  +
#[derive(Clone)]
         290  +
pub struct AcronymInsideService<
         291  +
    S = ::aws_smithy_legacy_http_server::routing::RoutingService<
         292  +
        ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
         293  +
            ::aws_smithy_legacy_http_server::routing::Route<
         294  +
                ::aws_smithy_legacy_http_server::body::BoxBody,
         295  +
            >,
         296  +
        >,
         297  +
        ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         298  +
    >,
         299  +
> {
         300  +
    // This is the router wrapped by layers.
         301  +
    svc: S,
         302  +
}
         303  +
         304  +
impl AcronymInsideService<()> {
         305  +
    /// Constructs a builder for [`AcronymInsideService`].
         306  +
    /// You must specify a configuration object holding any plugins and layers that should be applied
         307  +
    /// to the operations in this service.
         308  +
    pub fn builder<
         309  +
        Body,
         310  +
        L,
         311  +
        HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
         312  +
        ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
         313  +
    >(
         314  +
        config: AcronymInsideServiceConfig<L, HttpPl, ModelPl>,
         315  +
    ) -> AcronymInsideServiceBuilder<Body, L, HttpPl, ModelPl> {
         316  +
        AcronymInsideServiceBuilder {
         317  +
            do_nothing: None,
         318  +
            layer: config.layers,
         319  +
            http_plugin: config.http_plugins,
         320  +
            model_plugin: config.model_plugins,
         321  +
        }
         322  +
    }
         323  +
         324  +
    /// Constructs a builder for [`AcronymInsideService`].
         325  +
    /// You must specify what plugins should be applied to the operations in this service.
         326  +
    ///
         327  +
    /// Use [`AcronymInsideService::builder_without_plugins`] if you don't need to apply plugins.
         328  +
    ///
         329  +
    /// Check out [`HttpPlugins`](::aws_smithy_legacy_http_server::plugin::HttpPlugins) and
         330  +
    /// [`ModelPlugins`](::aws_smithy_legacy_http_server::plugin::ModelPlugins) if you need to apply
         331  +
    /// multiple plugins.
         332  +
    #[deprecated(
         333  +
        since = "0.57.0",
         334  +
        note = "please use the `builder` constructor and register plugins on the `AcronymInsideServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
         335  +
    )]
         336  +
    pub fn builder_with_plugins<
         337  +
        Body,
         338  +
        HttpPl: ::aws_smithy_legacy_http_server::plugin::HttpMarker,
         339  +
        ModelPl: ::aws_smithy_legacy_http_server::plugin::ModelMarker,
         340  +
    >(
         341  +
        http_plugin: HttpPl,
         342  +
        model_plugin: ModelPl,
         343  +
    ) -> AcronymInsideServiceBuilder<Body, ::tower::layer::util::Identity, HttpPl, ModelPl> {
         344  +
        AcronymInsideServiceBuilder {
         345  +
            do_nothing: None,
         346  +
            layer: ::tower::layer::util::Identity::new(),
         347  +
            http_plugin,
         348  +
            model_plugin,
         349  +
        }
         350  +
    }
         351  +
         352  +
    /// Constructs a builder for [`AcronymInsideService`].
         353  +
    ///
         354  +
    /// Use [`AcronymInsideService::builder_with_plugins`] if you need to specify plugins.
         355  +
    #[deprecated(
         356  +
        since = "0.57.0",
         357  +
        note = "please use the `builder` constructor instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
         358  +
    )]
         359  +
    pub fn builder_without_plugins<Body>() -> AcronymInsideServiceBuilder<
         360  +
        Body,
         361  +
        ::tower::layer::util::Identity,
         362  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         363  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         364  +
    > {
         365  +
        Self::builder_with_plugins(
         366  +
            ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         367  +
            ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         368  +
        )
         369  +
    }
         370  +
}
         371  +
         372  +
impl<S> AcronymInsideService<S> {
         373  +
    /// Converts [`AcronymInsideService`] into a [`MakeService`](tower::make::MakeService).
         374  +
    pub fn into_make_service(
         375  +
        self,
         376  +
    ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeService<Self> {
         377  +
        ::aws_smithy_legacy_http_server::routing::IntoMakeService::new(self)
         378  +
    }
         379  +
         380  +
    /// Converts [`AcronymInsideService`] into a [`MakeService`](tower::make::MakeService) with [`ConnectInfo`](::aws_smithy_legacy_http_server::request::connect_info::ConnectInfo).
         381  +
    pub fn into_make_service_with_connect_info<C>(
         382  +
        self,
         383  +
    ) -> ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo<Self, C> {
         384  +
        ::aws_smithy_legacy_http_server::routing::IntoMakeServiceWithConnectInfo::new(self)
         385  +
    }
         386  +
}
         387  +
         388  +
impl<S>
         389  +
    AcronymInsideService<
         390  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         391  +
            ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<S>,
         392  +
            ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         393  +
        >,
         394  +
    >
         395  +
{
         396  +
    /// Applies a [`Layer`](::tower::Layer) uniformly to all routes.
         397  +
    #[deprecated(
         398  +
        since = "0.57.0",
         399  +
        note = "please add layers to the `AcronymInsideServiceConfig` object instead; see https://github.com/smithy-lang/smithy-rs/discussions/3096"
         400  +
    )]
         401  +
    pub fn layer<L>(
         402  +
        self,
         403  +
        layer: &L,
         404  +
    ) -> AcronymInsideService<
         405  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         406  +
            ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<L::Service>,
         407  +
            ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         408  +
        >,
         409  +
    >
         410  +
    where
         411  +
        L: ::tower::Layer<S>,
         412  +
    {
         413  +
        AcronymInsideService {
         414  +
            svc: self.svc.map(|s| s.layer(layer)),
         415  +
        }
         416  +
    }
         417  +
         418  +
    /// Applies [`Route::new`](::aws_smithy_legacy_http_server::routing::Route::new) to all routes.
         419  +
    ///
         420  +
    /// This has the effect of erasing all types accumulated via layers.
         421  +
    pub fn boxed<B>(
         422  +
        self,
         423  +
    ) -> AcronymInsideService<
         424  +
        ::aws_smithy_legacy_http_server::routing::RoutingService<
         425  +
            ::aws_smithy_legacy_http_server::protocol::aws_json::router::AwsJsonRouter<
         426  +
                ::aws_smithy_legacy_http_server::routing::Route<B>,
         427  +
            >,
         428  +
            ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1,
         429  +
        >,
         430  +
    >
         431  +
    where
         432  +
        S: ::tower::Service<
         433  +
            ::http::Request<B>,
         434  +
            Response = ::http::Response<::aws_smithy_legacy_http_server::body::BoxBody>,
         435  +
            Error = std::convert::Infallible,
         436  +
        >,
         437  +
        S: Clone + Send + 'static,
         438  +
        S::Future: Send + 'static,
         439  +
    {
         440  +
        self.layer(&::tower::layer::layer_fn(
         441  +
            ::aws_smithy_legacy_http_server::routing::Route::new,
         442  +
        ))
         443  +
    }
         444  +
}
         445  +
         446  +
impl<S, R> ::tower::Service<R> for AcronymInsideService<S>
         447  +
where
         448  +
    S: ::tower::Service<R>,
         449  +
{
         450  +
    type Response = S::Response;
         451  +
    type Error = S::Error;
         452  +
    type Future = S::Future;
         453  +
         454  +
    fn poll_ready(
         455  +
        &mut self,
         456  +
        cx: &mut std::task::Context,
         457  +
    ) -> std::task::Poll<::std::result::Result<(), Self::Error>> {
         458  +
        self.svc.poll_ready(cx)
         459  +
    }
         460  +
         461  +
    fn call(&mut self, request: R) -> Self::Future {
         462  +
        self.svc.call(request)
         463  +
    }
         464  +
}
         465  +
         466  +
/// An enumeration of all [operations](https://smithy.io/2.0/spec/service-types.html#operation) in AcronymInsideService.
         467  +
#[allow(clippy::enum_variant_names)]
         468  +
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
         469  +
pub enum Operation {
         470  +
    DoNothing,
         471  +
}
         472  +
         473  +
impl Operation {
         474  +
    /// Returns the [operations](https://smithy.io/2.0/spec/service-types.html#operation) [`ShapeId`](::aws_smithy_legacy_http_server::shape_id::ShapeId).
         475  +
    pub fn shape_id(&self) -> ::aws_smithy_legacy_http_server::shape_id::ShapeId {
         476  +
        match self {
         477  +
            Operation::DoNothing => ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
         478  +
                "casing#DoNothing",
         479  +
                "casing",
         480  +
                "DoNothing",
         481  +
            ),
         482  +
        }
         483  +
    }
         484  +
}
         485  +
impl<L>
         486  +
    ::aws_smithy_legacy_http_server::service::ContainsOperation<crate::operation_shape::DoNothing>
         487  +
    for AcronymInsideService<L>
         488  +
{
         489  +
    const VALUE: Operation = Operation::DoNothing;
         490  +
}
         491  +
         492  +
impl<S> ::aws_smithy_legacy_http_server::service::ServiceShape for AcronymInsideService<S> {
         493  +
    const ID: ::aws_smithy_legacy_http_server::shape_id::ShapeId =
         494  +
        ::aws_smithy_legacy_http_server::shape_id::ShapeId::new(
         495  +
            "casing#ACRONYMInside_Service",
         496  +
            "casing",
         497  +
            "ACRONYMInside_Service",
         498  +
        );
         499  +
         500  +
    const VERSION: Option<&'static str> = Some("");
         501  +
         502  +
    type Protocol = ::aws_smithy_legacy_http_server::protocol::aws_json_11::AwsJson1_1;
         503  +
         504  +
    type Operations = Operation;
         505  +
}
         506  +
/// Configuration for the [`AcronymInsideService`]. This is the central place where to register and
         507  +
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
         508  +
///
         509  +
/// ```rust,no_run
         510  +
/// # use naming_test_casing_http0x::AcronymInsideServiceConfig;
         511  +
/// # use ::aws_smithy_legacy_http_server::plugin::IdentityPlugin;
         512  +
/// # use ::tower::layer::util::Identity;
         513  +
/// # let authentication_plugin = IdentityPlugin;
         514  +
/// # let authorization_plugin = IdentityPlugin;
         515  +
/// # let server_request_id_provider_layer = Identity::new();
         516  +
/// let config = AcronymInsideServiceConfig::builder()
         517  +
///     // Layers get executed first...
         518  +
///     .layer(server_request_id_provider_layer)
         519  +
///     // ...then HTTP plugins...
         520  +
///     .http_plugin(authentication_plugin)
         521  +
///     // ...and right after deserialization, model plugins.
         522  +
///     .model_plugin(authorization_plugin)
         523  +
///     .build();
         524  +
/// ```
         525  +
///
         526  +
/// See the [`plugin`] system for details.
         527  +
///
         528  +
/// [`plugin`]: ::aws_smithy_legacy_http_server::plugin
         529  +
#[derive(::std::fmt::Debug)]
         530  +
pub struct AcronymInsideServiceConfig<L, H, M> {
         531  +
    layers: L,
         532  +
    http_plugins: H,
         533  +
    model_plugins: M,
         534  +
}
         535  +
         536  +
impl AcronymInsideServiceConfig<(), (), ()> {
         537  +
    /// Returns a builder to construct the configuration.
         538  +
    pub fn builder() -> AcronymInsideServiceConfigBuilder<
         539  +
        ::tower::layer::util::Identity,
         540  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         541  +
        ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         542  +
    > {
         543  +
        AcronymInsideServiceConfigBuilder {
         544  +
            layers: ::tower::layer::util::Identity::new(),
         545  +
            http_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         546  +
            model_plugins: ::aws_smithy_legacy_http_server::plugin::IdentityPlugin,
         547  +
        }
         548  +
    }
         549  +
}
         550  +
         551  +
/// Builder returned by [`AcronymInsideServiceConfig::builder()`].
         552  +
#[derive(::std::fmt::Debug)]
         553  +
pub struct AcronymInsideServiceConfigBuilder<L, H, M> {
         554  +
    pub(crate) layers: L,
         555  +
    pub(crate) http_plugins: H,
         556  +
    pub(crate) model_plugins: M,
         557  +
}
         558  +
         559  +
impl<L, H, M> AcronymInsideServiceConfigBuilder<L, H, M> {
         560  +
    /// Add a [`::tower::Layer`] to the service.
         561  +
    pub fn layer<NewLayer>(
         562  +
        self,
         563  +
        layer: NewLayer,
         564  +
    ) -> AcronymInsideServiceConfigBuilder<::tower::layer::util::Stack<NewLayer, L>, H, M> {
         565  +
        AcronymInsideServiceConfigBuilder {
         566  +
            layers: ::tower::layer::util::Stack::new(layer, self.layers),
         567  +
            http_plugins: self.http_plugins,
         568  +
            model_plugins: self.model_plugins,
         569  +
        }
         570  +
    }
         571  +
         572  +
    /// Add a HTTP [plugin] to the service.
         573  +
    ///
         574  +
    /// [plugin]: ::aws_smithy_legacy_http_server::plugin
         575  +
    // We eagerly require `NewPlugin: HttpMarker`, despite not really needing it, because compiler
         576  +
    // errors get _substantially_ better if the user makes a mistake.
         577  +
    pub fn http_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::HttpMarker>(
         578  +
        self,
         579  +
        http_plugin: NewPlugin,
         580  +
    ) -> AcronymInsideServiceConfigBuilder<
         581  +
        L,
         582  +
        ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, H>,
         583  +
        M,
         584  +
    > {
         585  +
        AcronymInsideServiceConfigBuilder {
         586  +
            layers: self.layers,
         587  +
            http_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
         588  +
                http_plugin,
         589  +
                self.http_plugins,
         590  +
            ),
         591  +
            model_plugins: self.model_plugins,
         592  +
        }
         593  +
    }
         594  +
         595  +
    /// Add a model [plugin] to the service.
         596  +
    ///
         597  +
    /// [plugin]: ::aws_smithy_legacy_http_server::plugin
         598  +
    // We eagerly require `NewPlugin: ModelMarker`, despite not really needing it, because compiler
         599  +
    // errors get _substantially_ better if the user makes a mistake.
         600  +
    pub fn model_plugin<NewPlugin: ::aws_smithy_legacy_http_server::plugin::ModelMarker>(
         601  +
        self,
         602  +
        model_plugin: NewPlugin,
         603  +
    ) -> AcronymInsideServiceConfigBuilder<
         604  +
        L,
         605  +
        H,
         606  +
        ::aws_smithy_legacy_http_server::plugin::PluginStack<NewPlugin, M>,
         607  +
    > {
         608  +
        AcronymInsideServiceConfigBuilder {
         609  +
            layers: self.layers,
         610  +
            http_plugins: self.http_plugins,
         611  +
            model_plugins: ::aws_smithy_legacy_http_server::plugin::PluginStack::new(
         612  +
                model_plugin,
         613  +
                self.model_plugins,
         614  +
            ),
         615  +
        }
         616  +
    }
         617  +
         618  +
    /// Build the configuration.
         619  +
    pub fn build(self) -> super::AcronymInsideServiceConfig<L, H, M> {
         620  +
        super::AcronymInsideServiceConfig {
         621  +
            layers: self.layers,
         622  +
            http_plugins: self.http_plugins,
         623  +
            model_plugins: self.model_plugins,
         624  +
        }
         625  +
    }
         626  +
}
         627  +
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
         628  +
///
         629  +
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
         630  +
/// of the service and any operations _not_ specified will be placed in the opposing group.
         631  +
///
         632  +
/// # Example
         633  +
///
         634  +
/// ```rust
         635  +
/// scope! {
         636  +
///     /// Includes [`DoNothing`], excluding all other operations.
         637  +
///     struct ScopeA {
         638  +
///         includes: [DoNothing]
         639  +
///     }
         640  +
/// }
         641  +
///
         642  +
/// scope! {
         643  +
///     /// Excludes [`DoNothing`], excluding all other operations.
         644  +
///     struct ScopeB {
         645  +
///         excludes: [DoNothing]
         646  +
///     }
         647  +
/// }
         648  +
///
         649  +
/// # use naming_test_casing_http0x::server::plugin::{Plugin, Scoped};
         650  +
/// # use naming_test_casing_http0x::scope;
         651  +
/// # struct MockPlugin;
         652  +
/// # impl<S, Op, T> Plugin<S, Op, T> for MockPlugin { type Output = u32; fn apply(&self, input: T) -> u32 { 3 } }
         653  +
/// # let scoped_a = Scoped::new::<ScopeA>(MockPlugin);
         654  +
/// # let scoped_b = Scoped::new::<ScopeB>(MockPlugin);
         655  +
/// # let a = Plugin::<(), naming_test_casing_http0x::operation_shape::DoNothing, u64>::apply(&scoped_a, 6);
         656  +
/// # let b = Plugin::<(), naming_test_casing_http0x::operation_shape::DoNothing, u64>::apply(&scoped_b, 6);
         657  +
/// # assert_eq!(a, 3_u32);
         658  +
/// # assert_eq!(b, 6_u64);
         659  +
/// ```
         660  +
#[macro_export]
         661  +
macro_rules! scope {
         662  +
                    // Completed, render impls
         663  +
                    (@ $ name: ident, $ contains: ident () ($($ temp: ident)*) ($($ not_member: ident)*)) => {
         664  +
                        $(
         665  +
                            impl $ crate::server::plugin::scoped::Membership<$ temp> for $ name {
         666  +
                                type Contains = $ crate::server::plugin::scoped::$ contains;
         667  +
                            }
         668  +
                        )*
         669  +
                        $(
         670  +
                            impl $ crate::server::plugin::scoped::Membership<$ not_member> for $ name {
         671  +
                                type Contains = $ crate::server::plugin::scoped::$ contains;
         672  +
                            }
         673  +
                        )*
         674  +
                    };
         675  +
                    // All `not_member`s exhausted, move `temp` into `not_member`
         676  +
                    (@ $ name: ident, $ contains: ident ($($ member: ident)*) ($($ temp: ident)*) ()) => {
         677  +
                        scope! { @ $ name, $ contains ($($ member)*) () ($($ temp)*) }
         678  +
                    };
         679  +
         680  +
                        // DoNothing match found, pop from both `member` and `not_member`
         681  +
                        (@ $ name: ident, $ contains: ident (DoNothing $($ member: ident)*) ($($ temp: ident)*) (DoNothing $($ not_member: ident)*)) => {
         682  +
                            scope! { @ $ name, $ contains ($($ member)*) ($($ temp)*) ($($ not_member)*) }
         683  +
                        };
         684  +
                        // DoNothing match not found, pop from `not_member` into `temp` stack
         685  +
                        (@ $ name: ident, $ contains: ident (DoNothing $($ member: ident)*) ($($ temp: ident)*) ($ other: ident $($ not_member: ident)*)) => {
         686  +
                            scope! { @ $ name, $ contains (DoNothing $($ member)*) ($ other $($ temp)*) ($($ not_member)*) }
         687  +
                        };
         688  +
         689  +
                    (
         690  +
                        $(#[$ attrs:meta])*
         691  +
                        $ vis:vis struct $ name:ident {
         692  +
                            includes: [$($ include:ident),*]
         693  +
                        }
         694  +
                    ) => {
         695  +
                        use $ crate::operation_shape::*;
         696  +
                        $ crate::server::scope! {
         697  +
                            $(#[$ attrs])*
         698  +
                            $ vis struct $ name {
         699  +
                                includes: [$($ include),*],
         700  +
                                excludes: []
         701  +
                            }
         702  +
                        }
         703  +
                        scope! { @ $ name, False ($($ include)*) () (DoNothing) }
         704  +
                    };
         705  +
                    (
         706  +
                        $(#[$ attrs:meta])*
         707  +
                        $ vis:vis struct $ name:ident {
         708  +
                            excludes: [$($ exclude:ident),*]
         709  +
                        }
         710  +
                    ) => {
         711  +
                        use $ crate::operation_shape::*;
         712  +
         713  +
                        $ crate::server::scope! {
         714  +
                            $(#[$ attrs])*
         715  +
                            $ vis struct $ name {
         716  +
                                includes: [],
         717  +
                                excludes: [$($ exclude),*]
         718  +
                            }
         719  +
                        }
         720  +
                        scope! { @ $ name, True ($($ exclude)*) () (DoNothing) }
         721  +
                    };
         722  +
                }