Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_sparse_string_map.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:659 */
    2      3   
pub(crate) fn de_sparse_string_map(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::collections::HashMap<
    6      7   
        ::std::string::String,
    7      8   
        ::std::option::Option<::std::string::String>,
    8      9   
    >,
    9     10   
    ::aws_smithy_cbor::decode::DeserializeError,
   10     11   
> {
   11     12   
    fn pair(

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_sparse_struct_map.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:659 */
    2      3   
pub(crate) fn de_sparse_struct_map(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::collections::HashMap<
    6      7   
        ::std::string::String,
    7      8   
        ::std::option::Option<crate::model::GreetingStruct>,
    8      9   
    >,
    9     10   
    ::aws_smithy_cbor::decode::DeserializeError,
   10     11   
> {
   11     12   
    fn pair(

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_string_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_string_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<::std::string::String>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: ::std::vec::Vec<::std::string::String>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_string_set.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_string_set(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_structure_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_structure_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<crate::model::StructureListMember>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: ::std::vec::Vec<crate::model::StructureListMember>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_structure_list_member.rs

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

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_test_string_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_test_string_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<::std::string::String>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: ::std::vec::Vec<::std::string::String>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_test_string_map.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:659 */
    2      3   
pub(crate) fn de_test_string_map(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn pair(
    9     10   
        mut map: ::std::collections::HashMap<::std::string::String, ::std::string::String>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_timestamp_list.rs

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborParserGenerator.kt:616 */
    2      3   
pub(crate) fn de_timestamp_list(
    3      4   
    decoder: &mut ::aws_smithy_cbor::Decoder,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<::aws_smithy_types::DateTime>,
    6      7   
    ::aws_smithy_cbor::decode::DeserializeError,
    7      8   
> {
    8      9   
    fn member(
    9     10   
        mut list: ::std::vec::Vec<::aws_smithy_types::DateTime>,
   10     11   
        decoder: &mut ::aws_smithy_cbor::Decoder,
   11     12   
    ) -> ::std::result::Result<

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_validation_exception.rs

@@ -1,1 +40,66 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:228 */
    2      3   
pub fn ser_validation_exception_error(
    3      4   
    value: &crate::error::ValidationException,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::vec::Vec<u8>,
    6      7   
    ::aws_smithy_types::error::operation::SerializationError,
    7      8   
> {
           9  +
    /* CborSerializerGenerator.kt:233 */
    8     10   
    let mut encoder = ::aws_smithy_cbor::Encoder::new(::std::vec::Vec::new());
          11  +
    /* CborSerializerGenerator.kt:235 */
    9     12   
    {
          13  +
        /* CborSerializerGenerator.kt:236 */
   10     14   
        let encoder = &mut encoder;
          15  +
        /* CborSerializerGenerator.kt:403 */
   11     16   
        crate::protocol_serde::shape_validation_exception::ser_validation_exception(
   12     17   
            encoder, value,
   13     18   
        )?;
          19  +
        /* CborSerializerGenerator.kt:235 */
   14     20   
    }
          21  +
    /* CborSerializerGenerator.kt:242 */
   15     22   
    ::std::result::Result::Ok(encoder.into_writer())
          23  +
    /* CborSerializerGenerator.kt:228 */
   16     24   
}
   17     25   
          26  +
/* CborSerializerGenerator.kt:369 */
   18     27   
pub fn ser_validation_exception(
   19     28   
    encoder: &mut ::aws_smithy_cbor::Encoder,
   20     29   
    #[allow(unused)] input: &crate::error::ValidationException,
   21     30   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          31  +
    /* CborSerializerGenerator.kt:377 */
   22     32   
    encoder.begin_map();
          33  +
    /* AddTypeFieldToServerErrorsCborCustomization.kt:47 */
   23     34   
    encoder
   24     35   
        .str("__type")
   25     36   
        .str("smithy.framework#ValidationException");
          37  +
    /* SerializerUtil.kt:42 */
   26     38   
    {
          39  +
        /* CborSerializerGenerator.kt:462 */
   27     40   
        encoder.str("message").str(input.message.as_str());
          41  +
        /* SerializerUtil.kt:42 */
   28     42   
    }
          43  +
    /* CborSerializerGenerator.kt:414 */
   29     44   
    if let Some(var_1) = &input.field_list {
          45  +
        /* CborSerializerGenerator.kt:486 */
   30     46   
        encoder.str("fieldList");
          47  +
        /* CborSerializerGenerator.kt:504 */
   31     48   
        encoder.array((*var_1).len());
          49  +
        /* CborSerializerGenerator.kt:506 */
   32     50   
        for item_2 in var_1 {
          51  +
            /* SerializerUtil.kt:42 */
   33     52   
            {
          53  +
                /* CborSerializerGenerator.kt:403 */
   34     54   
                crate::protocol_serde::shape_validation_exception_field::ser_validation_exception_field(encoder, item_2 )?;
          55  +
                /* SerializerUtil.kt:42 */
   35     56   
            }
          57  +
            /* CborSerializerGenerator.kt:506 */
   36     58   
        }
          59  +
        /* CborSerializerGenerator.kt:414 */
   37     60   
    }
          61  +
    /* CborSerializerGenerator.kt:393 */
   38     62   
    encoder.end();
          63  +
    /* CborSerializerGenerator.kt:394 */
   39     64   
    Ok(())
          65  +
    /* CborSerializerGenerator.kt:369 */
   40     66   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/protocol_serde/shape_validation_exception_field.rs

@@ -1,1 +15,26 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* CborSerializerGenerator.kt:369 */
    2      3   
pub fn ser_validation_exception_field(
    3      4   
    encoder: &mut ::aws_smithy_cbor::Encoder,
    4      5   
    #[allow(unused)] input: &crate::model::ValidationExceptionField,
    5      6   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           7  +
    /* CborSerializerGenerator.kt:377 */
    6      8   
    encoder.begin_map();
           9  +
    /* SerializerUtil.kt:42 */
    7     10   
    {
          11  +
        /* CborSerializerGenerator.kt:462 */
    8     12   
        encoder.str("path").str(input.path.as_str());
          13  +
        /* SerializerUtil.kt:42 */
    9     14   
    }
          15  +
    /* SerializerUtil.kt:42 */
   10     16   
    {
          17  +
        /* CborSerializerGenerator.kt:462 */
   11     18   
        encoder.str("message").str(input.message.as_str());
          19  +
        /* SerializerUtil.kt:42 */
   12     20   
    }
          21  +
    /* CborSerializerGenerator.kt:393 */
   13     22   
    encoder.end();
          23  +
    /* CborSerializerGenerator.kt:394 */
   14     24   
    Ok(())
          25  +
    /* CborSerializerGenerator.kt:369 */
   15     26   
}

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

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerServiceGenerator.kt:795 */
    2      3   
/// The service builder for [`RpcV2Protocol`].
    3      4   
///
    4      5   
/// Constructed via [`RpcV2Protocol::builder`].
    5      6   
pub struct RpcV2ProtocolBuilder<Body, L, HttpPl, ModelPl> {
    6      7   
    empty_input_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
    7      8   
    float16: Option<::aws_smithy_http_server::routing::Route<Body>>,
    8      9   
    fractional_seconds: Option<::aws_smithy_http_server::routing::Route<Body>>,
    9     10   
    greeting_with_errors: Option<::aws_smithy_http_server::routing::Route<Body>>,
   10     11   
    no_input_output: Option<::aws_smithy_http_server::routing::Route<Body>>,
   11     12   
    operation_with_defaults: Option<::aws_smithy_http_server::routing::Route<Body>>,
@@ -2717,2718 +2776,2778 @@
 2737   2738   
            "smithy.protocoltests.rpcv2Cbor",
 2738   2739   
            "RpcV2Protocol",
 2739   2740   
        );
 2740   2741   
 2741   2742   
    const VERSION: Option<&'static str> = Some("2020-07-14");
 2742   2743   
 2743   2744   
    type Protocol = ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor;
 2744   2745   
 2745   2746   
    type Operations = Operation;
 2746   2747   
}
        2748  +
/* ServiceConfigGenerator.kt:178 */
 2747   2749   
/// Configuration for the [`RpcV2Protocol`]. This is the central place where to register and
 2748   2750   
/// configure [`::tower::Layer`]s, HTTP plugins, and model plugins.
 2749   2751   
///
 2750   2752   
/// ```rust,no_run
 2751   2753   
/// # use rpcv2cbor::RpcV2ProtocolConfig;
 2752   2754   
/// # use ::aws_smithy_http_server::plugin::IdentityPlugin;
 2753   2755   
/// # use ::tower::layer::util::Identity;
 2754   2756   
/// # let authentication_plugin = IdentityPlugin;
 2755   2757   
/// # let authorization_plugin = IdentityPlugin;
 2756   2758   
/// # let server_request_id_provider_layer = Identity::new();
@@ -2832,2834 +2891,2894 @@
 2852   2854   
 2853   2855   
    /// Build the configuration.
 2854   2856   
    pub fn build(self) -> super::RpcV2ProtocolConfig<L, H, M> {
 2855   2857   
        super::RpcV2ProtocolConfig {
 2856   2858   
            layers: self.layers,
 2857   2859   
            http_plugins: self.http_plugins,
 2858   2860   
            model_plugins: self.model_plugins,
 2859   2861   
        }
 2860   2862   
    }
 2861   2863   
}
        2864  +
/* ScopeMacroGenerator.kt:81 */
 2862   2865   
/// A macro to help with scoping [plugins](crate::server::plugin) to a subset of all operations.
 2863   2866   
///
 2864   2867   
/// In contrast to [`crate::server::scope`](crate::server::scope), this macro has knowledge
 2865   2868   
/// of the service and any operations _not_ specified will be placed in the opposing group.
 2866   2869   
///
 2867   2870   
/// # Example
 2868   2871   
///
 2869   2872   
/// ```rust
 2870   2873   
/// scope! {
 2871   2874   
///     /// Includes [`EmptyInputOutput`], excluding all other operations.

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/types.rs

@@ -1,1 +0,7 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* SmithyTypesPubUseExtra.kt:66 */
    2      3   
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
           4  +
/* ServerRequiredCustomizations.kt:69 */
    3      5   
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
    4      6   
pub use ::aws_smithy_types::Blob;
    5         -
pub use ::aws_smithy_types::DateTime;
           7  +
/* SmithyTypesPubUseExtra.kt:69 */ pub use ::aws_smithy_types::DateTime;

tmp-codegen-diff/codegen-server-test/rpcv2Cbor/rust-server-codegen/src/unconstrained.rs

@@ -1,1 +152,192 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
pub(crate) mod sparse_set_map_unconstrained {
    4      4   
           5  +
    /* UnconstrainedMapGenerator.kt:79 */
    5      6   
    #[derive(Debug, Clone)]
    6      7   
    pub(crate) struct SparseSetMapUnconstrained(
    7      8   
        pub(crate)  std::collections::HashMap<
    8      9   
            ::std::string::String,
    9     10   
            ::std::option::Option<
   10     11   
                crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
   11     12   
            >,
   12     13   
        >,
   13     14   
    );
   14     15   
   15     16   
    impl From<SparseSetMapUnconstrained>
   16     17   
        for crate::constrained::MaybeConstrained<
   17     18   
            crate::constrained::sparse_set_map_constrained::SparseSetMapConstrained,
   18     19   
        >
   19     20   
    {
   20     21   
        fn from(value: SparseSetMapUnconstrained) -> Self {
   21     22   
            Self::Unconstrained(value)
   22     23   
        }
   23     24   
    }
          25  +
    /* UnconstrainedMapGenerator.kt:101 */
   24     26   
    impl std::convert::TryFrom<SparseSetMapUnconstrained>
   25     27   
        for crate::constrained::sparse_set_map_constrained::SparseSetMapConstrained
   26     28   
    {
          29  +
        /* UnconstrainedMapGenerator.kt:102 */
   27     30   
        type Error = crate::model::sparse_set_map::ConstraintViolation;
          31  +
        /* UnconstrainedMapGenerator.kt:104 */
   28     32   
        fn try_from(value: SparseSetMapUnconstrained) -> std::result::Result<Self, Self::Error> {
          33  +
            /* UnconstrainedMapGenerator.kt:186 */
   29     34   
            let res: ::std::result::Result<
   30     35   
                ::std::collections::HashMap<
   31     36   
                    ::std::string::String,
   32     37   
                    ::std::option::Option<crate::model::StringSet>,
   33     38   
                >,
   34     39   
                Self::Error,
   35     40   
            > = value
   36     41   
                .0
   37     42   
                .into_iter()
   38     43   
                .map(|(k, v)| match v {
   39     44   
                    None => Ok((k, None)),
   40     45   
                    Some(v) => match crate::model::StringSet::try_from(v) {
   41     46   
                        Ok(v) => Ok((k, Some(v))),
   42     47   
                        Err(inner_constraint_violation) => {
   43     48   
                            Err(Self::Error::Value(k, inner_constraint_violation))
   44     49   
                        }
   45     50   
                    },
   46     51   
                })
   47     52   
                .collect();
   48     53   
            let hm = res?;
          54  +
            /* UnconstrainedMapGenerator.kt:247 */
   49     55   
            Ok(Self(hm))
          56  +
            /* UnconstrainedMapGenerator.kt:104 */
   50     57   
        }
          58  +
        /* UnconstrainedMapGenerator.kt:101 */
   51     59   
    }
          60  +
          61  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   52     62   
}
   53     63   
pub(crate) mod string_set_unconstrained {
   54     64   
          65  +
    /* UnconstrainedCollectionGenerator.kt:77 */
   55     66   
    #[derive(Debug, Clone)]
   56     67   
    pub(crate) struct StringSetUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
   57     68   
   58     69   
    impl From<StringSetUnconstrained>
   59     70   
        for crate::constrained::MaybeConstrained<crate::model::StringSet>
   60     71   
    {
   61     72   
        fn from(value: StringSetUnconstrained) -> Self {
   62     73   
            Self::Unconstrained(value)
   63     74   
        }
   64     75   
    }
          76  +
    /* UnconstrainedCollectionGenerator.kt:97 */
   65     77   
    impl std::convert::TryFrom<StringSetUnconstrained> for crate::model::StringSet {
          78  +
        /* UnconstrainedCollectionGenerator.kt:98 */
   66     79   
        type Error = crate::model::string_set::ConstraintViolation;
          80  +
        /* UnconstrainedCollectionGenerator.kt:100 */
   67     81   
        fn try_from(value: StringSetUnconstrained) -> std::result::Result<Self, Self::Error> {
          82  +
            /* UnconstrainedCollectionGenerator.kt:185 */
   68     83   
            let inner = value.0;
          84  +
            /* UnconstrainedCollectionGenerator.kt:189 */
   69     85   
            Self::try_from(inner)
          86  +
            /* UnconstrainedCollectionGenerator.kt:100 */
   70     87   
        }
          88  +
        /* UnconstrainedCollectionGenerator.kt:97 */
   71     89   
    }
          90  +
          91  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   72     92   
}
   73     93   
pub(crate) mod dense_set_map_unconstrained {
   74     94   
          95  +
    /* UnconstrainedMapGenerator.kt:79 */
   75     96   
    #[derive(Debug, Clone)]
   76     97   
    pub(crate) struct DenseSetMapUnconstrained(
   77     98   
        pub(crate)  std::collections::HashMap<
   78     99   
            ::std::string::String,
   79    100   
            crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
   80    101   
        >,
   81    102   
    );
   82    103   
   83    104   
    impl From<DenseSetMapUnconstrained>
   84    105   
        for crate::constrained::MaybeConstrained<
   85    106   
            crate::constrained::dense_set_map_constrained::DenseSetMapConstrained,
   86    107   
        >
   87    108   
    {
   88    109   
        fn from(value: DenseSetMapUnconstrained) -> Self {
   89    110   
            Self::Unconstrained(value)
   90    111   
        }
   91    112   
    }
         113  +
    /* UnconstrainedMapGenerator.kt:101 */
   92    114   
    impl std::convert::TryFrom<DenseSetMapUnconstrained>
   93    115   
        for crate::constrained::dense_set_map_constrained::DenseSetMapConstrained
   94    116   
    {
         117  +
        /* UnconstrainedMapGenerator.kt:102 */
   95    118   
        type Error = crate::model::dense_set_map::ConstraintViolation;
         119  +
        /* UnconstrainedMapGenerator.kt:104 */
   96    120   
        fn try_from(value: DenseSetMapUnconstrained) -> std::result::Result<Self, Self::Error> {
         121  +
            /* UnconstrainedMapGenerator.kt:186 */
   97    122   
            let res: ::std::result::Result<
   98    123   
                ::std::collections::HashMap<::std::string::String, crate::model::StringSet>,
   99    124   
                Self::Error,
  100    125   
            > = value
  101    126   
                .0
  102    127   
                .into_iter()
  103    128   
                .map(|(k, v)| match crate::model::StringSet::try_from(v) {
  104    129   
                    Ok(v) => Ok((k, v)),
  105    130   
                    Err(inner_constraint_violation) => {
  106    131   
                        Err(Self::Error::Value(k, inner_constraint_violation))
  107    132   
                    }
  108    133   
                })
  109    134   
                .collect();
  110    135   
            let hm = res?;
         136  +
            /* UnconstrainedMapGenerator.kt:247 */
  111    137   
            Ok(Self(hm))
         138  +
            /* UnconstrainedMapGenerator.kt:104 */
  112    139   
        }
         140  +
        /* UnconstrainedMapGenerator.kt:101 */
  113    141   
    }
         142  +
         143  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  114    144   
}
  115    145   
pub(crate) mod foo_enum_list_unconstrained {
  116    146   
         147  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  117    148   
    #[derive(Debug, Clone)]
  118    149   
    pub(crate) struct FooEnumListUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
  119    150   
  120    151   
    impl From<FooEnumListUnconstrained>
  121    152   
        for crate::constrained::MaybeConstrained<
  122    153   
            crate::constrained::foo_enum_list_constrained::FooEnumListConstrained,
  123    154   
        >
  124    155   
    {
  125    156   
        fn from(value: FooEnumListUnconstrained) -> Self {
  126    157   
            Self::Unconstrained(value)
  127    158   
        }
  128    159   
    }
         160  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  129    161   
    impl std::convert::TryFrom<FooEnumListUnconstrained>
  130    162   
        for crate::constrained::foo_enum_list_constrained::FooEnumListConstrained
  131    163   
    {
         164  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  132    165   
        type Error = crate::model::foo_enum_list::ConstraintViolation;
         166  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  133    167   
        fn try_from(value: FooEnumListUnconstrained) -> std::result::Result<Self, Self::Error> {
         168  +
            /* UnconstrainedCollectionGenerator.kt:127 */
  134    169   
            let res: ::std::result::Result<
  135    170   
                ::std::vec::Vec<crate::model::FooEnum>,
  136    171   
                (usize, crate::model::foo_enum::ConstraintViolation),
  137    172   
            > = value
  138    173   
                .0
  139    174   
                .into_iter()
  140    175   
                .enumerate()
  141    176   
                .map(|(idx, inner)| {
  142    177   
                    inner
  143    178   
                        .try_into()
  144    179   
                        .map_err(|inner_violation| (idx, inner_violation))
  145    180   
                })
  146    181   
                .collect();
  147    182   
            let inner =
  148    183   
                res.map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
         184  +
            /* UnconstrainedCollectionGenerator.kt:191 */
  149    185   
            Ok(Self(inner))
         186  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  150    187   
        }
         188  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  151    189   
    }
         190  +
         191  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  152    192   
}

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

@@ -1,1 +107,119 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
    3      3   
pub(crate) mod complex_map_constrained {
    4      4   
           5  +
    /* PubCrateConstrainedMapGenerator.kt:80 */
    5      6   
    #[derive(Debug, Clone)]
    6      7   
    pub(crate) struct ComplexMapConstrained(
    7      8   
        pub(crate) std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
    8      9   
    );
    9     10   
   10     11   
    impl crate::constrained::Constrained for ComplexMapConstrained {
   11     12   
        type Unconstrained =
   12     13   
            crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained;
   13     14   
    }
          15  +
    /* PubCrateConstrainedMapGenerator.kt:99 */
   14     16   
    impl
   15     17   
        ::std::convert::From<
   16     18   
            ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
   17     19   
        > for ComplexMapConstrained
   18     20   
    {
   19     21   
        fn from(
   20     22   
            v: ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
   21     23   
        ) -> Self {
   22     24   
            Self(v)
   23     25   
        }
   24     26   
    }
   25     27   
   26     28   
    impl ::std::convert::From<ComplexMapConstrained>
   27     29   
        for ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>
   28     30   
    {
   29     31   
        fn from(v: ComplexMapConstrained) -> Self {
   30     32   
            v.0
   31     33   
        }
   32     34   
    }
          35  +
          36  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   33     37   
}
   34     38   
pub(crate) mod complex_list_constrained {
   35     39   
          40  +
    /* PubCrateConstrainedCollectionGenerator.kt:79 */
   36     41   
    #[derive(Debug, Clone)]
   37     42   
    pub(crate) struct ComplexListConstrained(
   38     43   
        pub(crate) std::vec::Vec<crate::constrained::complex_map_constrained::ComplexMapConstrained>,
   39     44   
    );
   40     45   
   41     46   
    impl crate::constrained::Constrained for ComplexListConstrained {
   42     47   
        type Unconstrained =
   43     48   
            crate::unconstrained::complex_list_unconstrained::ComplexListUnconstrained;
   44     49   
    }
          50  +
    /* PubCrateConstrainedCollectionGenerator.kt:108 */
   45     51   
    impl
   46     52   
        ::std::convert::From<
   47     53   
            ::std::vec::Vec<
   48     54   
                ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
   49     55   
            >,
   50     56   
        > for ComplexListConstrained
   51     57   
    {
   52     58   
        fn from(
   53     59   
            v: ::std::vec::Vec<
   54     60   
                ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
   55     61   
            >,
   56     62   
        ) -> Self {
   57     63   
            Self(v.into_iter().map(|item| item.into()).collect())
   58     64   
        }
   59     65   
    }
   60     66   
   61     67   
    impl ::std::convert::From<ComplexListConstrained>
   62     68   
        for ::std::vec::Vec<
   63     69   
            ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
   64     70   
        >
   65     71   
    {
   66     72   
        fn from(v: ComplexListConstrained) -> Self {
   67     73   
            v.0.into_iter().map(|item| item.into()).collect()
   68     74   
        }
   69     75   
    }
          76  +
          77  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   70     78   
}
   71     79   
pub(crate) mod struct_list_constrained {
   72     80   
          81  +
    /* PubCrateConstrainedCollectionGenerator.kt:79 */
   73     82   
    #[derive(Debug, Clone)]
   74     83   
    pub(crate) struct StructListConstrained(pub(crate) std::vec::Vec<crate::model::SimpleStruct>);
   75     84   
   76     85   
    impl crate::constrained::Constrained for StructListConstrained {
   77     86   
        type Unconstrained =
   78     87   
            crate::unconstrained::struct_list_unconstrained::StructListUnconstrained;
   79     88   
    }
          89  +
    /* PubCrateConstrainedCollectionGenerator.kt:108 */
   80     90   
    impl ::std::convert::From<::std::vec::Vec<crate::model::SimpleStruct>> for StructListConstrained {
   81     91   
        fn from(v: ::std::vec::Vec<crate::model::SimpleStruct>) -> Self {
   82     92   
            Self(v)
   83     93   
        }
   84     94   
    }
   85     95   
   86     96   
    impl ::std::convert::From<StructListConstrained> for ::std::vec::Vec<crate::model::SimpleStruct> {
   87     97   
        fn from(v: StructListConstrained) -> Self {
   88     98   
            v.0
   89     99   
        }
   90    100   
    }
         101  +
         102  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   91    103   
}
   92    104   
   93    105   
/*
   94    106   
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   95    107   
 * SPDX-License-Identifier: Apache-2.0
   96    108   
 */
   97    109   
   98    110   
pub(crate) trait Constrained {
   99    111   
    type Unconstrained;
  100    112   
}

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

@@ -1,1 +241,457 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
           3  +
/* ServerOperationErrorGenerator.kt:63 */
    3      4   
/// Error type for the `ComplexStructOperation` operation.
           5  +
/* ServerOperationErrorGenerator.kt:64 */
    4      6   
/// Each variant represents an error that can occur for the `ComplexStructOperation` operation.
           7  +
/* RustType.kt:516 */
    5      8   
#[derive(::std::fmt::Debug)]
    6         -
pub enum ComplexStructOperationError {
    7         -
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
           9  +
pub /* ServerOperationErrorGenerator.kt:66 */ enum ComplexStructOperationError {
          10  +
    /// /* ServerOperationErrorGenerator.kt:68 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          11  +
    /* ServerOperationErrorGenerator.kt:71 */
    8     12   
    ValidationException(crate::error::ValidationException),
          13  +
    /* ServerOperationErrorGenerator.kt:66 */
    9     14   
}
          15  +
/* ServerOperationErrorGenerator.kt:75 */
   10     16   
impl ::std::fmt::Display for ComplexStructOperationError {
          17  +
    /* ServerOperationErrorGenerator.kt:76 */
   11     18   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          19  +
        /* ServerOperationErrorGenerator.kt:139 */
   12     20   
        match &self {
   13         -
            ComplexStructOperationError::ValidationException(_inner) => _inner.fmt(f),
          21  +
            /* ServerOperationErrorGenerator.kt:142 */
          22  +
            ComplexStructOperationError::ValidationException(_inner) =>
          23  +
            /* ServerOperationErrorGenerator.kt:78 */
          24  +
            {
          25  +
                _inner.fmt(f)
          26  +
            }
          27  +
            /* ServerOperationErrorGenerator.kt:139 */
   14     28   
        }
          29  +
        /* ServerOperationErrorGenerator.kt:76 */
   15     30   
    }
          31  +
    /* ServerOperationErrorGenerator.kt:75 */
   16     32   
}
          33  +
/* ServerOperationErrorGenerator.kt:83 */
   17     34   
impl ComplexStructOperationError {
          35  +
    /* ServerOperationErrorGenerator.kt:87 */
   18     36   
    /// Returns `true` if the error kind is `ComplexStructOperationError::ValidationException`.
          37  +
    /* ServerOperationErrorGenerator.kt:88 */
   19     38   
    pub fn is_validation_exception(&self) -> bool {
          39  +
        /* ServerOperationErrorGenerator.kt:89 */
   20     40   
        matches!(&self, ComplexStructOperationError::ValidationException(_))
          41  +
        /* ServerOperationErrorGenerator.kt:88 */
   21     42   
    }
          43  +
    /* ServerOperationErrorGenerator.kt:92 */
   22     44   
    /// Returns the error name string by matching the correct variant.
          45  +
    /* ServerOperationErrorGenerator.kt:93 */
   23     46   
    pub fn name(&self) -> &'static str {
          47  +
        /* ServerOperationErrorGenerator.kt:139 */
   24     48   
        match &self {
   25         -
            ComplexStructOperationError::ValidationException(_inner) => _inner.name(),
          49  +
            /* ServerOperationErrorGenerator.kt:142 */
          50  +
            ComplexStructOperationError::ValidationException(_inner) =>
          51  +
            /* ServerOperationErrorGenerator.kt:95 */
          52  +
            {
          53  +
                _inner.name()
   26     54   
            }
          55  +
            /* ServerOperationErrorGenerator.kt:139 */
   27     56   
        }
          57  +
        /* ServerOperationErrorGenerator.kt:93 */
          58  +
    }
          59  +
    /* ServerOperationErrorGenerator.kt:83 */
   28     60   
}
          61  +
/* ServerOperationErrorGenerator.kt:100 */
   29     62   
impl ::std::error::Error for ComplexStructOperationError {
          63  +
    /* ServerOperationErrorGenerator.kt:101 */
   30     64   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          65  +
        /* ServerOperationErrorGenerator.kt:139 */
   31     66   
        match &self {
   32         -
            ComplexStructOperationError::ValidationException(_inner) => Some(_inner),
          67  +
            /* ServerOperationErrorGenerator.kt:142 */
          68  +
            ComplexStructOperationError::ValidationException(_inner) =>
          69  +
            /* ServerOperationErrorGenerator.kt:103 */
          70  +
            {
          71  +
                Some(_inner)
          72  +
            }
          73  +
            /* ServerOperationErrorGenerator.kt:139 */
   33     74   
        }
          75  +
        /* ServerOperationErrorGenerator.kt:101 */
   34     76   
    }
          77  +
    /* ServerOperationErrorGenerator.kt:100 */
   35     78   
}
          79  +
/* ServerOperationErrorGenerator.kt:110 */
   36     80   
impl ::std::convert::From<crate::error::ValidationException>
   37     81   
    for crate::error::ComplexStructOperationError
   38     82   
{
          83  +
    /* ServerOperationErrorGenerator.kt:111 */
   39     84   
    fn from(
   40     85   
        variant: crate::error::ValidationException,
   41     86   
    ) -> crate::error::ComplexStructOperationError {
          87  +
        /* ServerOperationErrorGenerator.kt:112 */
   42     88   
        Self::ValidationException(variant)
          89  +
        /* ServerOperationErrorGenerator.kt:111 */
   43     90   
    }
          91  +
    /* ServerOperationErrorGenerator.kt:110 */
   44     92   
}
   45     93   
   46         -
/// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          94  +
/// /* StructureGenerator.kt:197 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
          95  +
/* RustType.kt:516 */
   47     96   
#[derive(
   48     97   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
   49     98   
)]
   50         -
pub struct ValidationException {
   51         -
    /// A summary of the validation failure.
          99  +
pub /* StructureGenerator.kt:201 */ struct ValidationException {
         100  +
    /// /* StructureGenerator.kt:231 */A summary of the validation failure.
   52    101   
    pub message: ::std::string::String,
   53         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         102  +
    /// /* StructureGenerator.kt:231 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
   54    103   
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         104  +
    /* StructureGenerator.kt:201 */
   55    105   
}
         106  +
/* StructureGenerator.kt:135 */
   56    107   
impl ValidationException {
   57         -
    /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         108  +
    /// /* StructureGenerator.kt:231 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         109  +
    /* StructureGenerator.kt:166 */
   58    110   
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
         111  +
        /* StructureGenerator.kt:169 */
   59    112   
        self.field_list.as_deref()
         113  +
        /* StructureGenerator.kt:166 */
   60    114   
    }
         115  +
    /* StructureGenerator.kt:135 */
   61    116   
}
         117  +
/* ErrorImplGenerator.kt:99 */
   62    118   
impl ValidationException {
         119  +
    /* ErrorImplGenerator.kt:128 */
   63    120   
    /// Returns the error message.
   64    121   
    pub fn message(&self) -> &str {
   65    122   
        &self.message
   66    123   
    }
         124  +
    /* ErrorImplGenerator.kt:141 */
   67    125   
    #[doc(hidden)]
   68    126   
    /// Returns the error name.
   69    127   
    pub fn name(&self) -> &'static str {
   70    128   
        "ValidationException"
   71    129   
    }
         130  +
    /* ErrorImplGenerator.kt:99 */
   72    131   
}
         132  +
/* ErrorImplGenerator.kt:153 */
   73    133   
impl ::std::fmt::Display for ValidationException {
         134  +
    /* ErrorImplGenerator.kt:154 */
   74    135   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         136  +
        /* ErrorImplGenerator.kt:161 */
   75    137   
        ::std::write!(f, "ValidationException")?;
         138  +
        /* ErrorImplGenerator.kt:166 */
   76    139   
        {
         140  +
            /* ErrorImplGenerator.kt:167 */
   77    141   
            ::std::write!(f, ": {}", &self.message)?;
         142  +
            /* ErrorImplGenerator.kt:166 */
   78    143   
        }
         144  +
        /* ErrorImplGenerator.kt:171 */
   79    145   
        Ok(())
         146  +
        /* ErrorImplGenerator.kt:154 */
   80    147   
    }
         148  +
    /* ErrorImplGenerator.kt:153 */
   81    149   
}
         150  +
/* ErrorImplGenerator.kt:175 */
   82    151   
impl ::std::error::Error for ValidationException {}
         152  +
/* ServerCodegenVisitor.kt:345 */
   83    153   
impl ValidationException {
   84         -
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         154  +
    /// /* ServerBuilderGenerator.kt:294 */Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         155  +
    /* ServerBuilderGenerator.kt:295 */
   85    156   
    pub fn builder() -> crate::error::validation_exception::Builder {
         157  +
        /* ServerBuilderGenerator.kt:296 */
   86    158   
        crate::error::validation_exception::Builder::default()
         159  +
        /* ServerBuilderGenerator.kt:295 */
   87    160   
    }
         161  +
    /* ServerCodegenVisitor.kt:345 */
   88    162   
}
   89    163   
         164  +
/* ServerOperationErrorGenerator.kt:63 */
   90    165   
/// Error type for the `ErrorSerializationOperation` operation.
         166  +
/* ServerOperationErrorGenerator.kt:64 */
   91    167   
/// Each variant represents an error that can occur for the `ErrorSerializationOperation` operation.
         168  +
/* RustType.kt:516 */
   92    169   
#[derive(::std::fmt::Debug)]
   93         -
pub enum ErrorSerializationOperationError {
   94         -
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         170  +
pub /* ServerOperationErrorGenerator.kt:66 */ enum ErrorSerializationOperationError {
         171  +
    /// /* ServerOperationErrorGenerator.kt:68 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         172  +
    /* ServerOperationErrorGenerator.kt:71 */
   95    173   
    ValidationException(crate::error::ValidationException),
         174  +
    /* ServerOperationErrorGenerator.kt:66 */
   96    175   
}
         176  +
/* ServerOperationErrorGenerator.kt:75 */
   97    177   
impl ::std::fmt::Display for ErrorSerializationOperationError {
         178  +
    /* ServerOperationErrorGenerator.kt:76 */
   98    179   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         180  +
        /* ServerOperationErrorGenerator.kt:139 */
   99    181   
        match &self {
  100         -
            ErrorSerializationOperationError::ValidationException(_inner) => _inner.fmt(f),
         182  +
            /* ServerOperationErrorGenerator.kt:142 */
         183  +
            ErrorSerializationOperationError::ValidationException(_inner) =>
         184  +
            /* ServerOperationErrorGenerator.kt:78 */
         185  +
            {
         186  +
                _inner.fmt(f)
         187  +
            }
         188  +
            /* ServerOperationErrorGenerator.kt:139 */
  101    189   
        }
         190  +
        /* ServerOperationErrorGenerator.kt:76 */
  102    191   
    }
         192  +
    /* ServerOperationErrorGenerator.kt:75 */
  103    193   
}
         194  +
/* ServerOperationErrorGenerator.kt:83 */
  104    195   
impl ErrorSerializationOperationError {
         196  +
    /* ServerOperationErrorGenerator.kt:87 */
  105    197   
    /// Returns `true` if the error kind is `ErrorSerializationOperationError::ValidationException`.
         198  +
    /* ServerOperationErrorGenerator.kt:88 */
  106    199   
    pub fn is_validation_exception(&self) -> bool {
         200  +
        /* ServerOperationErrorGenerator.kt:89 */
  107    201   
        matches!(
  108    202   
            &self,
  109    203   
            ErrorSerializationOperationError::ValidationException(_)
  110    204   
        )
         205  +
        /* ServerOperationErrorGenerator.kt:88 */
  111    206   
    }
         207  +
    /* ServerOperationErrorGenerator.kt:92 */
  112    208   
    /// Returns the error name string by matching the correct variant.
         209  +
    /* ServerOperationErrorGenerator.kt:93 */
  113    210   
    pub fn name(&self) -> &'static str {
         211  +
        /* ServerOperationErrorGenerator.kt:139 */
  114    212   
        match &self {
  115         -
            ErrorSerializationOperationError::ValidationException(_inner) => _inner.name(),
         213  +
            /* ServerOperationErrorGenerator.kt:142 */
         214  +
            ErrorSerializationOperationError::ValidationException(_inner) =>
         215  +
            /* ServerOperationErrorGenerator.kt:95 */
         216  +
            {
         217  +
                _inner.name()
  116    218   
            }
         219  +
            /* ServerOperationErrorGenerator.kt:139 */
  117    220   
        }
         221  +
        /* ServerOperationErrorGenerator.kt:93 */
         222  +
    }
         223  +
    /* ServerOperationErrorGenerator.kt:83 */
  118    224   
}
         225  +
/* ServerOperationErrorGenerator.kt:100 */
  119    226   
impl ::std::error::Error for ErrorSerializationOperationError {
         227  +
    /* ServerOperationErrorGenerator.kt:101 */
  120    228   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         229  +
        /* ServerOperationErrorGenerator.kt:139 */
  121    230   
        match &self {
  122         -
            ErrorSerializationOperationError::ValidationException(_inner) => Some(_inner),
         231  +
            /* ServerOperationErrorGenerator.kt:142 */
         232  +
            ErrorSerializationOperationError::ValidationException(_inner) =>
         233  +
            /* ServerOperationErrorGenerator.kt:103 */
         234  +
            {
         235  +
                Some(_inner)
  123    236   
            }
         237  +
            /* ServerOperationErrorGenerator.kt:139 */
  124    238   
        }
         239  +
        /* ServerOperationErrorGenerator.kt:101 */
         240  +
    }
         241  +
    /* ServerOperationErrorGenerator.kt:100 */
  125    242   
}
         243  +
/* ServerOperationErrorGenerator.kt:110 */
  126    244   
impl ::std::convert::From<crate::error::ValidationException>
  127    245   
    for crate::error::ErrorSerializationOperationError
  128    246   
{
         247  +
    /* ServerOperationErrorGenerator.kt:111 */
  129    248   
    fn from(
  130    249   
        variant: crate::error::ValidationException,
  131    250   
    ) -> crate::error::ErrorSerializationOperationError {
         251  +
        /* ServerOperationErrorGenerator.kt:112 */
  132    252   
        Self::ValidationException(variant)
         253  +
        /* ServerOperationErrorGenerator.kt:111 */
  133    254   
    }
         255  +
    /* ServerOperationErrorGenerator.kt:110 */
  134    256   
}
  135    257   
         258  +
/* ServerOperationErrorGenerator.kt:63 */
  136    259   
/// Error type for the `SimpleStructOperation` operation.
         260  +
/* ServerOperationErrorGenerator.kt:64 */
  137    261   
/// Each variant represents an error that can occur for the `SimpleStructOperation` operation.
         262  +
/* RustType.kt:516 */
  138    263   
#[derive(::std::fmt::Debug)]
  139         -
pub enum SimpleStructOperationError {
  140         -
    /// A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         264  +
pub /* ServerOperationErrorGenerator.kt:66 */ enum SimpleStructOperationError {
         265  +
    /// /* ServerOperationErrorGenerator.kt:68 */A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
         266  +
    /* ServerOperationErrorGenerator.kt:71 */
  141    267   
    ValidationException(crate::error::ValidationException),
         268  +
    /* ServerOperationErrorGenerator.kt:66 */
  142    269   
}
         270  +
/* ServerOperationErrorGenerator.kt:75 */
  143    271   
impl ::std::fmt::Display for SimpleStructOperationError {
         272  +
    /* ServerOperationErrorGenerator.kt:76 */
  144    273   
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         274  +
        /* ServerOperationErrorGenerator.kt:139 */
  145    275   
        match &self {
  146         -
            SimpleStructOperationError::ValidationException(_inner) => _inner.fmt(f),
         276  +
            /* ServerOperationErrorGenerator.kt:142 */
         277  +
            SimpleStructOperationError::ValidationException(_inner) =>
         278  +
            /* ServerOperationErrorGenerator.kt:78 */
         279  +
            {
         280  +
                _inner.fmt(f)
         281  +
            }
         282  +
            /* ServerOperationErrorGenerator.kt:139 */
  147    283   
        }
         284  +
        /* ServerOperationErrorGenerator.kt:76 */
  148    285   
    }
         286  +
    /* ServerOperationErrorGenerator.kt:75 */
  149    287   
}
         288  +
/* ServerOperationErrorGenerator.kt:83 */
  150    289   
impl SimpleStructOperationError {
         290  +
    /* ServerOperationErrorGenerator.kt:87 */
  151    291   
    /// Returns `true` if the error kind is `SimpleStructOperationError::ValidationException`.
         292  +
    /* ServerOperationErrorGenerator.kt:88 */
  152    293   
    pub fn is_validation_exception(&self) -> bool {
         294  +
        /* ServerOperationErrorGenerator.kt:89 */
  153    295   
        matches!(&self, SimpleStructOperationError::ValidationException(_))
         296  +
        /* ServerOperationErrorGenerator.kt:88 */
  154    297   
    }
         298  +
    /* ServerOperationErrorGenerator.kt:92 */
  155    299   
    /// Returns the error name string by matching the correct variant.
         300  +
    /* ServerOperationErrorGenerator.kt:93 */
  156    301   
    pub fn name(&self) -> &'static str {
         302  +
        /* ServerOperationErrorGenerator.kt:139 */
  157    303   
        match &self {
  158         -
            SimpleStructOperationError::ValidationException(_inner) => _inner.name(),
         304  +
            /* ServerOperationErrorGenerator.kt:142 */
         305  +
            SimpleStructOperationError::ValidationException(_inner) =>
         306  +
            /* ServerOperationErrorGenerator.kt:95 */
         307  +
            {
         308  +
                _inner.name()
         309  +
            }
         310  +
            /* ServerOperationErrorGenerator.kt:139 */
  159    311   
        }
         312  +
        /* ServerOperationErrorGenerator.kt:93 */
  160    313   
    }
         314  +
    /* ServerOperationErrorGenerator.kt:83 */
  161    315   
}
         316  +
/* ServerOperationErrorGenerator.kt:100 */
  162    317   
impl ::std::error::Error for SimpleStructOperationError {
         318  +
    /* ServerOperationErrorGenerator.kt:101 */
  163    319   
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         320  +
        /* ServerOperationErrorGenerator.kt:139 */
  164    321   
        match &self {
  165         -
            SimpleStructOperationError::ValidationException(_inner) => Some(_inner),
         322  +
            /* ServerOperationErrorGenerator.kt:142 */
         323  +
            SimpleStructOperationError::ValidationException(_inner) =>
         324  +
            /* ServerOperationErrorGenerator.kt:103 */
         325  +
            {
         326  +
                Some(_inner)
  166    327   
            }
         328  +
            /* ServerOperationErrorGenerator.kt:139 */
  167    329   
        }
         330  +
        /* ServerOperationErrorGenerator.kt:101 */
         331  +
    }
         332  +
    /* ServerOperationErrorGenerator.kt:100 */
  168    333   
}
         334  +
/* ServerOperationErrorGenerator.kt:110 */
  169    335   
impl ::std::convert::From<crate::error::ValidationException>
  170    336   
    for crate::error::SimpleStructOperationError
  171    337   
{
         338  +
    /* ServerOperationErrorGenerator.kt:111 */
  172    339   
    fn from(
  173    340   
        variant: crate::error::ValidationException,
  174    341   
    ) -> crate::error::SimpleStructOperationError {
         342  +
        /* ServerOperationErrorGenerator.kt:112 */
  175    343   
        Self::ValidationException(variant)
         344  +
        /* ServerOperationErrorGenerator.kt:111 */
  176    345   
    }
         346  +
    /* ServerOperationErrorGenerator.kt:110 */
  177    347   
}
  178         -
/// See [`ValidationException`](crate::error::ValidationException).
         348  +
/// /* ServerBuilderGenerator.kt:171 */See [`ValidationException`](crate::error::ValidationException).
  179    349   
pub mod validation_exception {
  180    350   
         351  +
    /* RustType.kt:516 */
  181    352   
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
  182         -
    /// Holds one variant for each of the ways the builder can fail.
         353  +
    /// /* ServerBuilderConstraintViolations.kt:72 */Holds one variant for each of the ways the builder can fail.
         354  +
    /* RustType.kt:516 */
  183    355   
    #[non_exhaustive]
         356  +
    /* ServerBuilderConstraintViolations.kt:75 */
  184    357   
    #[allow(clippy::enum_variant_names)]
  185    358   
    pub enum ConstraintViolation {
  186         -
        /// `message` was not provided but it is required when building `ValidationException`.
         359  +
        /// /* ServerBuilderConstraintViolations.kt:138 */`message` was not provided but it is required when building `ValidationException`.
         360  +
        /* ServerBuilderConstraintViolations.kt:143 */
  187    361   
        MissingMessage,
         362  +
        /* ServerBuilderConstraintViolations.kt:75 */
  188    363   
    }
         364  +
    /* ServerBuilderConstraintViolations.kt:117 */
  189    365   
    impl ::std::fmt::Display for ConstraintViolation {
         366  +
        /* ServerBuilderConstraintViolations.kt:118 */
  190    367   
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         368  +
            /* ServerBuilderConstraintViolations.kt:119 */
  191    369   
            match self {
  192         -
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
  193         -
            }
         370  +
                /* ServerBuilderConstraintViolations.kt:127 */ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
         371  +
            /* ServerBuilderConstraintViolations.kt:119 */}
         372  +
            /* ServerBuilderConstraintViolations.kt:118 */
  194    373   
        }
         374  +
        /* ServerBuilderConstraintViolations.kt:117 */
  195    375   
    }
         376  +
    /* ServerBuilderConstraintViolations.kt:84 */
  196    377   
    impl ::std::error::Error for ConstraintViolation {}
         378  +
    /* ServerBuilderGenerator.kt:446 */
  197    379   
    impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
  198    380   
        type Error = ConstraintViolation;
  199    381   
  200    382   
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
  201    383   
            builder.build()
  202    384   
        }
  203    385   
    }
  204         -
    /// A builder for [`ValidationException`](crate::error::ValidationException).
         386  +
    /// /* ServerBuilderGenerator.kt:201 */A builder for [`ValidationException`](crate::error::ValidationException).
         387  +
    /* RustType.kt:516 */
  205    388   
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         389  +
    /* ServerBuilderGenerator.kt:211 */
  206    390   
    pub struct Builder {
         391  +
        /* ServerBuilderGenerator.kt:308 */
  207    392   
        pub(crate) message: ::std::option::Option<::std::string::String>,
         393  +
        /* ServerBuilderGenerator.kt:308 */
  208    394   
        pub(crate) field_list:
  209    395   
            ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         396  +
        /* ServerBuilderGenerator.kt:211 */
  210    397   
    }
         398  +
    /* ServerBuilderGenerator.kt:215 */
  211    399   
    impl Builder {
  212         -
        /// A summary of the validation failure.
         400  +
        /// /* ServerBuilderGenerator.kt:331 */A summary of the validation failure.
         401  +
        /* ServerBuilderGenerator.kt:343 */
  213    402   
        pub fn message(mut self, input: ::std::string::String) -> Self {
  214         -
            self.message = Some(input);
         403  +
            /* ServerBuilderGenerator.kt:344 */
         404  +
            self.message =
         405  +
                /* ServerBuilderGenerator.kt:345 */Some(
         406  +
                    /* ServerBuilderGenerator.kt:376 */input
         407  +
                /* ServerBuilderGenerator.kt:345 */)
         408  +
            /* ServerBuilderGenerator.kt:344 */;
  215    409   
            self
         410  +
            /* ServerBuilderGenerator.kt:343 */
  216    411   
        }
  217         -
        /// A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         412  +
        /// /* ServerBuilderGenerator.kt:331 */A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
         413  +
        /* ServerBuilderGenerator.kt:343 */
  218    414   
        pub fn field_list(
  219    415   
            mut self,
  220    416   
            input: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
  221    417   
        ) -> Self {
  222         -
            self.field_list = input;
         418  +
            /* ServerBuilderGenerator.kt:344 */
         419  +
            self.field_list =
         420  +
                /* ServerBuilderGenerator.kt:376 */input
         421  +
            /* ServerBuilderGenerator.kt:344 */;
  223    422   
            self
         423  +
            /* ServerBuilderGenerator.kt:343 */
  224    424   
        }
  225         -
        /// Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
  226         -
        ///
         425  +
        /// /* ServerBuilderGenerator.kt:258 */Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
         426  +
        /// /* ServerBuilderGenerator.kt:260 */
  227    427   
        /// The builder fails to construct a [`ValidationException`](crate::error::ValidationException) if a [`ConstraintViolation`] occurs.
  228    428   
        ///
         429  +
        /* ServerBuilderGenerator.kt:271 */
  229    430   
        pub fn build(self) -> Result<crate::error::ValidationException, ConstraintViolation> {
  230    431   
            self.build_enforcing_all_constraints()
  231    432   
        }
         433  +
        /* ServerBuilderGenerator.kt:283 */
  232    434   
        fn build_enforcing_all_constraints(
  233    435   
            self,
  234    436   
        ) -> Result<crate::error::ValidationException, ConstraintViolation> {
  235         -
            Ok(crate::error::ValidationException {
  236         -
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
         437  +
            /* ServerBuilderGenerator.kt:287 */
         438  +
            Ok(
         439  +
                /* ServerBuilderGenerator.kt:542 */
         440  +
                crate::error::ValidationException {
         441  +
                    /* ServerBuilderGenerator.kt:546 */
         442  +
                    message: self
         443  +
                        .message
         444  +
                        /* ServerBuilderGenerator.kt:569 */
         445  +
                        .ok_or(ConstraintViolation::MissingMessage)?,
         446  +
                    /* ServerBuilderGenerator.kt:546 */
  237    447   
                    field_list: self.field_list,
  238         -
            })
         448  +
                    /* ServerBuilderGenerator.kt:542 */
         449  +
                }, /* ServerBuilderGenerator.kt:287 */
         450  +
            )
         451  +
            /* ServerBuilderGenerator.kt:283 */
  239    452   
        }
         453  +
        /* ServerBuilderGenerator.kt:215 */
  240    454   
    }
         455  +
         456  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  241    457   
}