Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9 (ignoring whitespace)

Files changed:

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

@@ -1,1 +0,15 @@
    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::body::SdkBody;
    3      4   
pub use ::aws_smithy_types::byte_stream::error::Error as ByteStreamError;
    4      5   
pub use ::aws_smithy_types::byte_stream::AggregatedBytes;
    5         -
pub use ::aws_smithy_types::byte_stream::ByteStream;
           6  +
/* SmithyTypesPubUseExtra.kt:86 */ pub use ::aws_smithy_types::byte_stream::ByteStream;
    6      7   
#[cfg(feature = "rt-tokio")]
    7      8   
pub use ::aws_smithy_types::byte_stream::FsBuilder;
    8      9   
#[cfg(feature = "rt-tokio")]
    9     10   
pub use ::aws_smithy_types::byte_stream::Length;
   10     11   
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
          12  +
/* ServerRequiredCustomizations.kt:76 */
   11     13   
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
   12     14   
pub use ::aws_smithy_types::Blob;
   13         -
pub use ::aws_smithy_types::DateTime;
          15  +
/* SmithyTypesPubUseExtra.kt:69 */ pub use ::aws_smithy_types::DateTime;

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

@@ -1,1 +338,429 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
           3  +
/* UnconstrainedUnionGenerator.kt:121 */
    3      4   
impl crate::constrained::Constrained for crate::model::MyUnion {
    4      5   
    type Unconstrained = crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained;
    5      6   
}
    6      7   
    7      8   
impl From<crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained>
    8      9   
    for crate::constrained::MaybeConstrained<crate::model::MyUnion>
    9     10   
{
   10     11   
    fn from(value: crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained) -> Self {
   11     12   
        Self::Unconstrained(value)
   12     13   
    }
   13     14   
}
   14     15   
   15     16   
pub(crate) mod my_union_unconstrained {
   16     17   
          18  +
    /* UnconstrainedUnionGenerator.kt:82 */
   17     19   
    #[allow(clippy::enum_variant_names)]
   18     20   
    #[derive(Debug, Clone)]
   19     21   
    pub(crate) enum MyUnionUnconstrained {
   20         -
        BlobValue(::aws_smithy_types::Blob),
   21         -
        BooleanValue(bool),
   22         -
        EnumValue(::std::string::String),
          22  +
        /* UnconstrainedUnionGenerator.kt:95 */ BlobValue(::aws_smithy_types::Blob),
          23  +
        /* UnconstrainedUnionGenerator.kt:95 */ BooleanValue(bool),
          24  +
        /* UnconstrainedUnionGenerator.kt:95 */ EnumValue(::std::string::String),
          25  +
        /* UnconstrainedUnionGenerator.kt:95 */
   23     26   
        ListValue(::std::vec::Vec<::std::string::String>),
          27  +
        /* UnconstrainedUnionGenerator.kt:95 */
   24     28   
        MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
   25         -
        NumberValue(i32),
          29  +
        /* UnconstrainedUnionGenerator.kt:95 */ NumberValue(i32),
          30  +
        /* UnconstrainedUnionGenerator.kt:95 */
   26     31   
        RenamedStructureValue(crate::model::RenamedGreeting),
   27         -
        StringValue(::std::string::String),
          32  +
        /* UnconstrainedUnionGenerator.kt:95 */ StringValue(::std::string::String),
          33  +
        /* UnconstrainedUnionGenerator.kt:95 */
   28     34   
        StructureValue(crate::model::GreetingStruct),
          35  +
        /* UnconstrainedUnionGenerator.kt:95 */
   29     36   
        TimestampValue(::aws_smithy_types::DateTime),
          37  +
        /* UnconstrainedUnionGenerator.kt:82 */
   30     38   
    }
          39  +
    /* UnconstrainedUnionGenerator.kt:103 */
   31     40   
    impl ::std::convert::TryFrom<MyUnionUnconstrained> for crate::model::MyUnion {
   32     41   
        type Error = crate::model::my_union::ConstraintViolation;
   33     42   
   34     43   
        fn try_from(value: MyUnionUnconstrained) -> ::std::result::Result<Self, Self::Error> {
   35     44   
            Ok(
   36     45   
        match value {
   37     46   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BlobValue(unconstrained) => Self::BlobValue(
   38     47   
                unconstrained
   39     48   
            ),
   40     49   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::BooleanValue(unconstrained) => Self::BooleanValue(
   41     50   
                unconstrained
   42     51   
            ),
   43     52   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::EnumValue(unconstrained) => Self::EnumValue(
   44     53   
                unconstrained
   45     54   
                                        .try_into()
   46     55   
                                        
   47     56   
                                        
   48     57   
                                        .map_err(Self::Error::EnumValue)?
   49     58   
            ),
   50     59   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::ListValue(unconstrained) => Self::ListValue(
   51     60   
                unconstrained
   52     61   
            ),
   53     62   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::MapValue(unconstrained) => Self::MapValue(
   54     63   
                unconstrained
   55     64   
            ),
   56     65   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::NumberValue(unconstrained) => Self::NumberValue(
   57     66   
                unconstrained
   58     67   
            ),
   59     68   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::RenamedStructureValue(unconstrained) => Self::RenamedStructureValue(
   60     69   
                unconstrained
   61     70   
            ),
   62     71   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StringValue(unconstrained) => Self::StringValue(
   63     72   
                unconstrained
   64     73   
            ),
   65     74   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::StructureValue(unconstrained) => Self::StructureValue(
   66     75   
                unconstrained
   67     76   
            ),
   68     77   
            crate::unconstrained::my_union_unconstrained::MyUnionUnconstrained::TimestampValue(unconstrained) => Self::TimestampValue(
   69     78   
                unconstrained
   70     79   
            ),
   71     80   
        }
   72     81   
    )
   73     82   
        }
   74     83   
    }
          84  +
          85  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
   75     86   
}
   76     87   
pub(crate) mod sparse_set_map_unconstrained {
   77     88   
          89  +
    /* UnconstrainedMapGenerator.kt:79 */
   78     90   
    #[derive(Debug, Clone)]
   79     91   
    pub(crate) struct SparseSetMapUnconstrained(
   80     92   
        pub(crate)  std::collections::HashMap<
   81     93   
            ::std::string::String,
   82     94   
            ::std::option::Option<
   83     95   
                crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
   84     96   
            >,
   85     97   
        >,
   86     98   
    );
   87     99   
   88    100   
    impl From<SparseSetMapUnconstrained>
   89    101   
        for crate::constrained::MaybeConstrained<
   90    102   
            crate::constrained::sparse_set_map_constrained::SparseSetMapConstrained,
   91    103   
        >
   92    104   
    {
   93    105   
        fn from(value: SparseSetMapUnconstrained) -> Self {
   94    106   
            Self::Unconstrained(value)
   95    107   
        }
   96    108   
    }
         109  +
    /* UnconstrainedMapGenerator.kt:101 */
   97    110   
    impl std::convert::TryFrom<SparseSetMapUnconstrained>
   98    111   
        for crate::constrained::sparse_set_map_constrained::SparseSetMapConstrained
   99    112   
    {
         113  +
        /* UnconstrainedMapGenerator.kt:102 */
  100    114   
        type Error = crate::model::sparse_set_map::ConstraintViolation;
         115  +
        /* UnconstrainedMapGenerator.kt:104 */
  101    116   
        fn try_from(value: SparseSetMapUnconstrained) -> std::result::Result<Self, Self::Error> {
         117  +
            /* UnconstrainedMapGenerator.kt:186 */
  102    118   
            let res: ::std::result::Result<
  103    119   
                ::std::collections::HashMap<
  104    120   
                    ::std::string::String,
  105    121   
                    ::std::option::Option<crate::model::StringSet>,
  106    122   
                >,
  107    123   
                Self::Error,
  108    124   
            > = value
  109    125   
                .0
  110    126   
                .into_iter()
  111    127   
                .map(|(k, v)| match v {
  112    128   
                    None => Ok((k, None)),
  113    129   
                    Some(v) => match crate::model::StringSet::try_from(v) {
  114    130   
                        Ok(v) => Ok((k, Some(v))),
  115    131   
                        Err(inner_constraint_violation) => {
  116    132   
                            Err(Self::Error::Value(k, inner_constraint_violation))
  117    133   
                        }
  118    134   
                    },
  119    135   
                })
  120    136   
                .collect();
  121    137   
            let hm = res?;
         138  +
            /* UnconstrainedMapGenerator.kt:247 */
  122    139   
            Ok(Self(hm))
         140  +
            /* UnconstrainedMapGenerator.kt:104 */
  123    141   
        }
         142  +
        /* UnconstrainedMapGenerator.kt:101 */
  124    143   
    }
         144  +
         145  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  125    146   
}
  126    147   
pub(crate) mod string_set_unconstrained {
  127    148   
         149  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  128    150   
    #[derive(Debug, Clone)]
  129    151   
    pub(crate) struct StringSetUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
  130    152   
  131    153   
    impl From<StringSetUnconstrained>
  132    154   
        for crate::constrained::MaybeConstrained<crate::model::StringSet>
  133    155   
    {
  134    156   
        fn from(value: StringSetUnconstrained) -> Self {
  135    157   
            Self::Unconstrained(value)
  136    158   
        }
  137    159   
    }
         160  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  138    161   
    impl std::convert::TryFrom<StringSetUnconstrained> for crate::model::StringSet {
         162  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  139    163   
        type Error = crate::model::string_set::ConstraintViolation;
         164  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  140    165   
        fn try_from(value: StringSetUnconstrained) -> std::result::Result<Self, Self::Error> {
         166  +
            /* UnconstrainedCollectionGenerator.kt:185 */
  141    167   
            let inner = value.0;
         168  +
            /* UnconstrainedCollectionGenerator.kt:189 */
  142    169   
            Self::try_from(inner)
         170  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  143    171   
        }
         172  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  144    173   
    }
         174  +
         175  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  145    176   
}
  146    177   
pub(crate) mod dense_set_map_unconstrained {
  147    178   
         179  +
    /* UnconstrainedMapGenerator.kt:79 */
  148    180   
    #[derive(Debug, Clone)]
  149    181   
    pub(crate) struct DenseSetMapUnconstrained(
  150    182   
        pub(crate)  std::collections::HashMap<
  151    183   
            ::std::string::String,
  152    184   
            crate::unconstrained::string_set_unconstrained::StringSetUnconstrained,
  153    185   
        >,
  154    186   
    );
  155    187   
  156    188   
    impl From<DenseSetMapUnconstrained>
  157    189   
        for crate::constrained::MaybeConstrained<
  158    190   
            crate::constrained::dense_set_map_constrained::DenseSetMapConstrained,
  159    191   
        >
  160    192   
    {
  161    193   
        fn from(value: DenseSetMapUnconstrained) -> Self {
  162    194   
            Self::Unconstrained(value)
  163    195   
        }
  164    196   
    }
         197  +
    /* UnconstrainedMapGenerator.kt:101 */
  165    198   
    impl std::convert::TryFrom<DenseSetMapUnconstrained>
  166    199   
        for crate::constrained::dense_set_map_constrained::DenseSetMapConstrained
  167    200   
    {
         201  +
        /* UnconstrainedMapGenerator.kt:102 */
  168    202   
        type Error = crate::model::dense_set_map::ConstraintViolation;
         203  +
        /* UnconstrainedMapGenerator.kt:104 */
  169    204   
        fn try_from(value: DenseSetMapUnconstrained) -> std::result::Result<Self, Self::Error> {
         205  +
            /* UnconstrainedMapGenerator.kt:186 */
  170    206   
            let res: ::std::result::Result<
  171    207   
                ::std::collections::HashMap<::std::string::String, crate::model::StringSet>,
  172    208   
                Self::Error,
  173    209   
            > = value
  174    210   
                .0
  175    211   
                .into_iter()
  176    212   
                .map(|(k, v)| match crate::model::StringSet::try_from(v) {
  177    213   
                    Ok(v) => Ok((k, v)),
  178    214   
                    Err(inner_constraint_violation) => {
  179    215   
                        Err(Self::Error::Value(k, inner_constraint_violation))
  180    216   
                    }
  181    217   
                })
  182    218   
                .collect();
  183    219   
            let hm = res?;
         220  +
            /* UnconstrainedMapGenerator.kt:247 */
  184    221   
            Ok(Self(hm))
         222  +
            /* UnconstrainedMapGenerator.kt:104 */
  185    223   
        }
         224  +
        /* UnconstrainedMapGenerator.kt:101 */
  186    225   
    }
         226  +
         227  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  187    228   
}
  188    229   
pub(crate) mod foo_enum_list_unconstrained {
  189    230   
         231  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  190    232   
    #[derive(Debug, Clone)]
  191    233   
    pub(crate) struct FooEnumListUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
  192    234   
  193    235   
    impl From<FooEnumListUnconstrained>
  194    236   
        for crate::constrained::MaybeConstrained<
  195    237   
            crate::constrained::foo_enum_list_constrained::FooEnumListConstrained,
  196    238   
        >
  197    239   
    {
  198    240   
        fn from(value: FooEnumListUnconstrained) -> Self {
  199    241   
            Self::Unconstrained(value)
  200    242   
        }
  201    243   
    }
         244  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  202    245   
    impl std::convert::TryFrom<FooEnumListUnconstrained>
  203    246   
        for crate::constrained::foo_enum_list_constrained::FooEnumListConstrained
  204    247   
    {
         248  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  205    249   
        type Error = crate::model::foo_enum_list::ConstraintViolation;
         250  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  206    251   
        fn try_from(value: FooEnumListUnconstrained) -> std::result::Result<Self, Self::Error> {
         252  +
            /* UnconstrainedCollectionGenerator.kt:127 */
  207    253   
            let res: ::std::result::Result<
  208    254   
                ::std::vec::Vec<crate::model::FooEnum>,
  209    255   
                (usize, crate::model::foo_enum::ConstraintViolation),
  210    256   
            > = value
  211    257   
                .0
  212    258   
                .into_iter()
  213    259   
                .enumerate()
  214    260   
                .map(|(idx, inner)| {
  215    261   
                    inner
  216    262   
                        .try_into()
  217    263   
                        .map_err(|inner_violation| (idx, inner_violation))
  218    264   
                })
  219    265   
                .collect();
  220    266   
            let inner =
  221    267   
                res.map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
         268  +
            /* UnconstrainedCollectionGenerator.kt:191 */
  222    269   
            Ok(Self(inner))
         270  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  223    271   
        }
         272  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  224    273   
    }
         274  +
         275  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  225    276   
}
  226    277   
pub(crate) mod integer_enum_set_unconstrained {
  227    278   
         279  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  228    280   
    #[derive(Debug, Clone)]
  229    281   
    pub(crate) struct IntegerEnumSetUnconstrained(pub(crate) std::vec::Vec<i32>);
  230    282   
  231    283   
    impl From<IntegerEnumSetUnconstrained>
  232    284   
        for crate::constrained::MaybeConstrained<crate::model::IntegerEnumSet>
  233    285   
    {
  234    286   
        fn from(value: IntegerEnumSetUnconstrained) -> Self {
  235    287   
            Self::Unconstrained(value)
  236    288   
        }
  237    289   
    }
         290  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  238    291   
    impl std::convert::TryFrom<IntegerEnumSetUnconstrained> for crate::model::IntegerEnumSet {
         292  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  239    293   
        type Error = crate::model::integer_enum_set::ConstraintViolation;
         294  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  240    295   
        fn try_from(value: IntegerEnumSetUnconstrained) -> std::result::Result<Self, Self::Error> {
         296  +
            /* UnconstrainedCollectionGenerator.kt:185 */
  241    297   
            let inner = value.0;
         298  +
            /* UnconstrainedCollectionGenerator.kt:189 */
  242    299   
            Self::try_from(inner)
         300  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  243    301   
        }
         302  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  244    303   
    }
         304  +
         305  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  245    306   
}
  246    307   
pub(crate) mod foo_enum_map_unconstrained {
  247    308   
         309  +
    /* UnconstrainedMapGenerator.kt:79 */
  248    310   
    #[derive(Debug, Clone)]
  249    311   
    pub(crate) struct FooEnumMapUnconstrained(
  250    312   
        pub(crate) std::collections::HashMap<::std::string::String, ::std::string::String>,
  251    313   
    );
  252    314   
  253    315   
    impl From<FooEnumMapUnconstrained>
  254    316   
        for crate::constrained::MaybeConstrained<
  255    317   
            crate::constrained::foo_enum_map_constrained::FooEnumMapConstrained,
  256    318   
        >
  257    319   
    {
  258    320   
        fn from(value: FooEnumMapUnconstrained) -> Self {
  259    321   
            Self::Unconstrained(value)
  260    322   
        }
  261    323   
    }
         324  +
    /* UnconstrainedMapGenerator.kt:101 */
  262    325   
    impl std::convert::TryFrom<FooEnumMapUnconstrained>
  263    326   
        for crate::constrained::foo_enum_map_constrained::FooEnumMapConstrained
  264    327   
    {
         328  +
        /* UnconstrainedMapGenerator.kt:102 */
  265    329   
        type Error = crate::model::foo_enum_map::ConstraintViolation;
         330  +
        /* UnconstrainedMapGenerator.kt:104 */
  266    331   
        fn try_from(value: FooEnumMapUnconstrained) -> std::result::Result<Self, Self::Error> {
         332  +
            /* UnconstrainedMapGenerator.kt:186 */
  267    333   
            let res: ::std::result::Result<
  268    334   
                ::std::collections::HashMap<::std::string::String, crate::model::FooEnum>,
  269    335   
                Self::Error,
  270    336   
            > = value
  271    337   
                .0
  272    338   
                .into_iter()
  273    339   
                .map(|(k, v)| match crate::model::FooEnum::try_from(v) {
  274    340   
                    Ok(v) => Ok((k, v)),
  275    341   
                    Err(inner_constraint_violation) => {
  276    342   
                        Err(Self::Error::Value(k, inner_constraint_violation))
  277    343   
                    }
  278    344   
                })
  279    345   
                .collect();
  280    346   
            let hm = res?;
         347  +
            /* UnconstrainedMapGenerator.kt:247 */
  281    348   
            Ok(Self(hm))
         349  +
            /* UnconstrainedMapGenerator.kt:104 */
  282    350   
        }
         351  +
        /* UnconstrainedMapGenerator.kt:101 */
  283    352   
    }
         353  +
         354  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  284    355   
}
  285    356   
pub(crate) mod foo_enum_set_unconstrained {
  286    357   
         358  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  287    359   
    #[derive(Debug, Clone)]
  288    360   
    pub(crate) struct FooEnumSetUnconstrained(pub(crate) std::vec::Vec<::std::string::String>);
  289    361   
  290    362   
    impl From<FooEnumSetUnconstrained>
  291    363   
        for crate::constrained::MaybeConstrained<crate::model::FooEnumSet>
  292    364   
    {
  293    365   
        fn from(value: FooEnumSetUnconstrained) -> Self {
  294    366   
            Self::Unconstrained(value)
  295    367   
        }
  296    368   
    }
         369  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  297    370   
    impl std::convert::TryFrom<FooEnumSetUnconstrained> for crate::model::FooEnumSet {
         371  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  298    372   
        type Error = crate::model::foo_enum_set::ConstraintViolation;
         373  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  299    374   
        fn try_from(value: FooEnumSetUnconstrained) -> std::result::Result<Self, Self::Error> {
         375  +
            /* UnconstrainedCollectionGenerator.kt:127 */
  300    376   
            let res: ::std::result::Result<
  301    377   
                ::std::vec::Vec<crate::model::FooEnum>,
  302    378   
                (usize, crate::model::foo_enum::ConstraintViolation),
  303    379   
            > = value
  304    380   
                .0
  305    381   
                .into_iter()
  306    382   
                .enumerate()
  307    383   
                .map(|(idx, inner)| {
  308    384   
                    inner
  309    385   
                        .try_into()
  310    386   
                        .map_err(|inner_violation| (idx, inner_violation))
  311    387   
                })
  312    388   
                .collect();
  313    389   
            let inner =
  314    390   
                res.map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
         391  +
            /* UnconstrainedCollectionGenerator.kt:189 */
  315    392   
            Self::try_from(inner)
         393  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  316    394   
        }
         395  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  317    396   
    }
         397  +
         398  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  318    399   
}
  319    400   
pub(crate) mod integer_set_unconstrained {
  320    401   
         402  +
    /* UnconstrainedCollectionGenerator.kt:77 */
  321    403   
    #[derive(Debug, Clone)]
  322    404   
    pub(crate) struct IntegerSetUnconstrained(pub(crate) std::vec::Vec<i32>);
  323    405   
  324    406   
    impl From<IntegerSetUnconstrained>
  325    407   
        for crate::constrained::MaybeConstrained<crate::model::IntegerSet>
  326    408   
    {
  327    409   
        fn from(value: IntegerSetUnconstrained) -> Self {
  328    410   
            Self::Unconstrained(value)
  329    411   
        }
  330    412   
    }
         413  +
    /* UnconstrainedCollectionGenerator.kt:97 */
  331    414   
    impl std::convert::TryFrom<IntegerSetUnconstrained> for crate::model::IntegerSet {
         415  +
        /* UnconstrainedCollectionGenerator.kt:98 */
  332    416   
        type Error = crate::model::integer_set::ConstraintViolation;
         417  +
        /* UnconstrainedCollectionGenerator.kt:100 */
  333    418   
        fn try_from(value: IntegerSetUnconstrained) -> std::result::Result<Self, Self::Error> {
         419  +
            /* UnconstrainedCollectionGenerator.kt:185 */
  334    420   
            let inner = value.0;
         421  +
            /* UnconstrainedCollectionGenerator.kt:189 */
  335    422   
            Self::try_from(inner)
         423  +
            /* UnconstrainedCollectionGenerator.kt:100 */
  336    424   
        }
         425  +
        /* UnconstrainedCollectionGenerator.kt:97 */
  337    426   
    }
         427  +
         428  +
    /* RustCrateInlineModuleComposingWriter.kt:299 */
  338    429   
}

tmp-codegen-diff/codegen-server-test/rest_json_extras-http0x/rust-server-codegen/Cargo.toml

@@ -0,1 +0,62 @@
           1  +
# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
[package]
           3  +
name = "rest_json_extras-http0x"
           4  +
version = "0.0.1"
           5  +
authors = ["protocoltest@example.com"]
           6  +
description = "test"
           7  +
edition = "2021"
           8  +
           9  +
[package.metadata.smithy]
          10  +
codegen-version = "ci"
          11  +
protocol = "aws.protocols#restJson1"
          12  +
[dependencies.aws-smithy-json]
          13  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-json"
          14  +
[dependencies.aws-smithy-legacy-http]
          15  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http"
          16  +
[dependencies.aws-smithy-legacy-http-server]
          17  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-legacy-http-server"
          18  +
[dependencies.aws-smithy-runtime-api]
          19  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
          20  +
features = ["http-02x"]
          21  +
[dependencies.aws-smithy-types]
          22  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          23  +
features = ["http-body-0-4-x"]
          24  +
[dependencies.form_urlencoded]
          25  +
version = "1"
          26  +
[dependencies.futures-util]
          27  +
version = "0.3"
          28  +
[dependencies.http]
          29  +
version = "0.2.9"
          30  +
[dependencies.hyper]
          31  +
version = "0.14.26"
          32  +
[dependencies.mime]
          33  +
version = "0.3"
          34  +
[dependencies.nom]
          35  +
version = "7"
          36  +
[dependencies.percent-encoding]
          37  +
version = "2.0.0"
          38  +
[dependencies.pin-project-lite]
          39  +
version = "0.2"
          40  +
[dependencies.tower]
          41  +
version = "0.4"
          42  +
[dependencies.tracing]
          43  +
version = "0.1"
          44  +
[dev-dependencies.aws-smithy-protocol-test]
          45  +
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-protocol-test"
          46  +
[dev-dependencies.bytes]
          47  +
version = "1.4.0"
          48  +
[dev-dependencies.pretty_assertions]
          49  +
version = "1.3.0"
          50  +
[dev-dependencies.tokio]
          51  +
version = "1.23.1"
          52  +
features = ["macros", "test-util", "rt-multi-thread"]
          53  +
[dev-dependencies.tracing-test]
          54  +
version = "0.2.5"
          55  +
features = ["no-env-filter"]
          56  +
[features]
          57  +
rt-tokio = ["aws-smithy-types/rt-tokio"]
          58  +
aws-lambda = ["aws-smithy-legacy-http-server/aws-lambda"]
          59  +
request-id = ["aws-smithy-legacy-http-server/request-id"]
          60  +
default = ["rt-tokio", "request-id"]
          61  +
          62  +

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

@@ -0,1 +0,49 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
pub(crate) mod map_with_enum_key_constrained {
           4  +
           5  +
    #[derive(Debug, Clone)]
           6  +
    pub(crate) struct MapWithEnumKeyConstrained(
           7  +
        pub(crate) std::collections::HashMap<crate::model::StringEnum, ::std::string::String>,
           8  +
    );
           9  +
          10  +
    impl crate::constrained::Constrained for MapWithEnumKeyConstrained {
          11  +
        type Unconstrained =
          12  +
            crate::unconstrained::map_with_enum_key_unconstrained::MapWithEnumKeyUnconstrained;
          13  +
    }
          14  +
    impl
          15  +
        ::std::convert::From<
          16  +
            ::std::collections::HashMap<crate::model::StringEnum, ::std::string::String>,
          17  +
        > for MapWithEnumKeyConstrained
          18  +
    {
          19  +
        fn from(
          20  +
            v: ::std::collections::HashMap<crate::model::StringEnum, ::std::string::String>,
          21  +
        ) -> Self {
          22  +
            Self(v)
          23  +
        }
          24  +
    }
          25  +
          26  +
    impl ::std::convert::From<MapWithEnumKeyConstrained>
          27  +
        for ::std::collections::HashMap<crate::model::StringEnum, ::std::string::String>
          28  +
    {
          29  +
        fn from(v: MapWithEnumKeyConstrained) -> Self {
          30  +
            v.0
          31  +
        }
          32  +
    }
          33  +
}
          34  +
          35  +
/*
          36  +
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
          37  +
 * SPDX-License-Identifier: Apache-2.0
          38  +
 */
          39  +
          40  +
pub(crate) trait Constrained {
          41  +
    type Unconstrained;
          42  +
}
          43  +
          44  +
#[derive(Debug, Clone)]
          45  +
#[allow(dead_code)]
          46  +
pub(crate) enum MaybeConstrained<T: Constrained> {
          47  +
    Constrained(T),
          48  +
    Unconstrained(T::Unconstrained),
          49  +
}

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

@@ -0,1 +0,782 @@
           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 ExtraError {}
           7  +
impl ExtraError {
           8  +
    #[doc(hidden)]
           9  +
    /// Returns the error name.
          10  +
    pub fn name(&self) -> &'static str {
          11  +
        "ExtraError"
          12  +
    }
          13  +
}
          14  +
impl ::std::fmt::Display for ExtraError {
          15  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          16  +
        ::std::write!(f, "ExtraError")?;
          17  +
        Ok(())
          18  +
    }
          19  +
}
          20  +
impl ::std::error::Error for ExtraError {}
          21  +
impl ExtraError {
          22  +
    /// Creates a new builder-style object to manufacture [`ExtraError`](crate::error::ExtraError).
          23  +
    pub fn builder() -> crate::error::extra_error::Builder {
          24  +
        crate::error::extra_error::Builder::default()
          25  +
    }
          26  +
}
          27  +
          28  +
/// Error type for the `HttpQueryParamsOnlyOperation` operation.
          29  +
/// Each variant represents an error that can occur for the `HttpQueryParamsOnlyOperation` operation.
          30  +
#[derive(::std::fmt::Debug)]
          31  +
pub enum HttpQueryParamsOnlyOperationError {
          32  +
    #[allow(missing_docs)] // documentation missing in model
          33  +
    ExtraError(crate::error::ExtraError),
          34  +
}
          35  +
impl ::std::fmt::Display for HttpQueryParamsOnlyOperationError {
          36  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          37  +
        match &self {
          38  +
            HttpQueryParamsOnlyOperationError::ExtraError(_inner) => _inner.fmt(f),
          39  +
        }
          40  +
    }
          41  +
}
          42  +
impl HttpQueryParamsOnlyOperationError {
          43  +
    /// Returns `true` if the error kind is `HttpQueryParamsOnlyOperationError::ExtraError`.
          44  +
    pub fn is_extra_error(&self) -> bool {
          45  +
        matches!(&self, HttpQueryParamsOnlyOperationError::ExtraError(_))
          46  +
    }
          47  +
    /// Returns the error name string by matching the correct variant.
          48  +
    pub fn name(&self) -> &'static str {
          49  +
        match &self {
          50  +
            HttpQueryParamsOnlyOperationError::ExtraError(_inner) => _inner.name(),
          51  +
        }
          52  +
    }
          53  +
}
          54  +
impl ::std::error::Error for HttpQueryParamsOnlyOperationError {
          55  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          56  +
        match &self {
          57  +
            HttpQueryParamsOnlyOperationError::ExtraError(_inner) => Some(_inner),
          58  +
        }
          59  +
    }
          60  +
}
          61  +
impl ::std::convert::From<crate::error::ExtraError>
          62  +
    for crate::error::HttpQueryParamsOnlyOperationError
          63  +
{
          64  +
    fn from(variant: crate::error::ExtraError) -> crate::error::HttpQueryParamsOnlyOperationError {
          65  +
        Self::ExtraError(variant)
          66  +
    }
          67  +
}
          68  +
          69  +
/// Error type for the `QueryPrecedence` operation.
          70  +
/// Each variant represents an error that can occur for the `QueryPrecedence` operation.
          71  +
#[derive(::std::fmt::Debug)]
          72  +
pub enum QueryPrecedenceError {
          73  +
    #[allow(missing_docs)] // documentation missing in model
          74  +
    ExtraError(crate::error::ExtraError),
          75  +
}
          76  +
impl ::std::fmt::Display for QueryPrecedenceError {
          77  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
          78  +
        match &self {
          79  +
            QueryPrecedenceError::ExtraError(_inner) => _inner.fmt(f),
          80  +
        }
          81  +
    }
          82  +
}
          83  +
impl QueryPrecedenceError {
          84  +
    /// Returns `true` if the error kind is `QueryPrecedenceError::ExtraError`.
          85  +
    pub fn is_extra_error(&self) -> bool {
          86  +
        matches!(&self, QueryPrecedenceError::ExtraError(_))
          87  +
    }
          88  +
    /// Returns the error name string by matching the correct variant.
          89  +
    pub fn name(&self) -> &'static str {
          90  +
        match &self {
          91  +
            QueryPrecedenceError::ExtraError(_inner) => _inner.name(),
          92  +
        }
          93  +
    }
          94  +
}
          95  +
impl ::std::error::Error for QueryPrecedenceError {
          96  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
          97  +
        match &self {
          98  +
            QueryPrecedenceError::ExtraError(_inner) => Some(_inner),
          99  +
        }
         100  +
    }
         101  +
}
         102  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::QueryPrecedenceError {
         103  +
    fn from(variant: crate::error::ExtraError) -> crate::error::QueryPrecedenceError {
         104  +
        Self::ExtraError(variant)
         105  +
    }
         106  +
}
         107  +
         108  +
/// Error type for the `EmptyStructWithContentOnWireOp` operation.
         109  +
/// Each variant represents an error that can occur for the `EmptyStructWithContentOnWireOp` operation.
         110  +
#[derive(::std::fmt::Debug)]
         111  +
pub enum EmptyStructWithContentOnWireOpError {
         112  +
    #[allow(missing_docs)] // documentation missing in model
         113  +
    ExtraError(crate::error::ExtraError),
         114  +
}
         115  +
impl ::std::fmt::Display for EmptyStructWithContentOnWireOpError {
         116  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         117  +
        match &self {
         118  +
            EmptyStructWithContentOnWireOpError::ExtraError(_inner) => _inner.fmt(f),
         119  +
        }
         120  +
    }
         121  +
}
         122  +
impl EmptyStructWithContentOnWireOpError {
         123  +
    /// Returns `true` if the error kind is `EmptyStructWithContentOnWireOpError::ExtraError`.
         124  +
    pub fn is_extra_error(&self) -> bool {
         125  +
        matches!(&self, EmptyStructWithContentOnWireOpError::ExtraError(_))
         126  +
    }
         127  +
    /// Returns the error name string by matching the correct variant.
         128  +
    pub fn name(&self) -> &'static str {
         129  +
        match &self {
         130  +
            EmptyStructWithContentOnWireOpError::ExtraError(_inner) => _inner.name(),
         131  +
        }
         132  +
    }
         133  +
}
         134  +
impl ::std::error::Error for EmptyStructWithContentOnWireOpError {
         135  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         136  +
        match &self {
         137  +
            EmptyStructWithContentOnWireOpError::ExtraError(_inner) => Some(_inner),
         138  +
        }
         139  +
    }
         140  +
}
         141  +
impl ::std::convert::From<crate::error::ExtraError>
         142  +
    for crate::error::EmptyStructWithContentOnWireOpError
         143  +
{
         144  +
    fn from(
         145  +
        variant: crate::error::ExtraError,
         146  +
    ) -> crate::error::EmptyStructWithContentOnWireOpError {
         147  +
        Self::ExtraError(variant)
         148  +
    }
         149  +
}
         150  +
         151  +
/// Error type for the `CaseInsensitiveErrorOperation` operation.
         152  +
/// Each variant represents an error that can occur for the `CaseInsensitiveErrorOperation` operation.
         153  +
#[derive(::std::fmt::Debug)]
         154  +
pub enum CaseInsensitiveErrorOperationError {
         155  +
    #[allow(missing_docs)] // documentation missing in model
         156  +
    CaseInsensitiveError(crate::error::CaseInsensitiveError),
         157  +
    #[allow(missing_docs)] // documentation missing in model
         158  +
    ExtraError(crate::error::ExtraError),
         159  +
}
         160  +
impl ::std::fmt::Display for CaseInsensitiveErrorOperationError {
         161  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         162  +
        match &self {
         163  +
            CaseInsensitiveErrorOperationError::CaseInsensitiveError(_inner) => _inner.fmt(f),
         164  +
            CaseInsensitiveErrorOperationError::ExtraError(_inner) => _inner.fmt(f),
         165  +
        }
         166  +
    }
         167  +
}
         168  +
impl CaseInsensitiveErrorOperationError {
         169  +
    /// Returns `true` if the error kind is `CaseInsensitiveErrorOperationError::CaseInsensitiveError`.
         170  +
    pub fn is_case_insensitive_error(&self) -> bool {
         171  +
        matches!(
         172  +
            &self,
         173  +
            CaseInsensitiveErrorOperationError::CaseInsensitiveError(_)
         174  +
        )
         175  +
    }
         176  +
    /// Returns `true` if the error kind is `CaseInsensitiveErrorOperationError::ExtraError`.
         177  +
    pub fn is_extra_error(&self) -> bool {
         178  +
        matches!(&self, CaseInsensitiveErrorOperationError::ExtraError(_))
         179  +
    }
         180  +
    /// Returns the error name string by matching the correct variant.
         181  +
    pub fn name(&self) -> &'static str {
         182  +
        match &self {
         183  +
            CaseInsensitiveErrorOperationError::CaseInsensitiveError(_inner) => _inner.name(),
         184  +
            CaseInsensitiveErrorOperationError::ExtraError(_inner) => _inner.name(),
         185  +
        }
         186  +
    }
         187  +
}
         188  +
impl ::std::error::Error for CaseInsensitiveErrorOperationError {
         189  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         190  +
        match &self {
         191  +
            CaseInsensitiveErrorOperationError::CaseInsensitiveError(_inner) => Some(_inner),
         192  +
            CaseInsensitiveErrorOperationError::ExtraError(_inner) => Some(_inner),
         193  +
        }
         194  +
    }
         195  +
}
         196  +
impl ::std::convert::From<crate::error::CaseInsensitiveError>
         197  +
    for crate::error::CaseInsensitiveErrorOperationError
         198  +
{
         199  +
    fn from(
         200  +
        variant: crate::error::CaseInsensitiveError,
         201  +
    ) -> crate::error::CaseInsensitiveErrorOperationError {
         202  +
        Self::CaseInsensitiveError(variant)
         203  +
    }
         204  +
}
         205  +
impl ::std::convert::From<crate::error::ExtraError>
         206  +
    for crate::error::CaseInsensitiveErrorOperationError
         207  +
{
         208  +
    fn from(variant: crate::error::ExtraError) -> crate::error::CaseInsensitiveErrorOperationError {
         209  +
        Self::ExtraError(variant)
         210  +
    }
         211  +
}
         212  +
         213  +
#[allow(missing_docs)] // documentation missing in model
         214  +
#[derive(
         215  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         216  +
)]
         217  +
pub struct CaseInsensitiveError {
         218  +
    #[allow(missing_docs)] // documentation missing in model
         219  +
    pub message: ::std::option::Option<::std::string::String>,
         220  +
}
         221  +
impl CaseInsensitiveError {
         222  +
    /// Returns the error message.
         223  +
    pub fn message(&self) -> ::std::option::Option<&str> {
         224  +
        self.message.as_deref()
         225  +
    }
         226  +
    #[doc(hidden)]
         227  +
    /// Returns the error name.
         228  +
    pub fn name(&self) -> &'static str {
         229  +
        "CaseInsensitiveError"
         230  +
    }
         231  +
}
         232  +
impl ::std::fmt::Display for CaseInsensitiveError {
         233  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         234  +
        ::std::write!(f, "CaseInsensitiveError")?;
         235  +
        if let ::std::option::Option::Some(inner_1) = &self.message {
         236  +
            {
         237  +
                ::std::write!(f, ": {inner_1}")?;
         238  +
            }
         239  +
        }
         240  +
        Ok(())
         241  +
    }
         242  +
}
         243  +
impl ::std::error::Error for CaseInsensitiveError {}
         244  +
impl CaseInsensitiveError {
         245  +
    /// Creates a new builder-style object to manufacture [`CaseInsensitiveError`](crate::error::CaseInsensitiveError).
         246  +
    pub fn builder() -> crate::error::case_insensitive_error::Builder {
         247  +
        crate::error::case_insensitive_error::Builder::default()
         248  +
    }
         249  +
}
         250  +
         251  +
/// Error type for the `NullInNonSparse` operation.
         252  +
/// Each variant represents an error that can occur for the `NullInNonSparse` operation.
         253  +
#[derive(::std::fmt::Debug)]
         254  +
pub enum NullInNonSparseError {
         255  +
    #[allow(missing_docs)] // documentation missing in model
         256  +
    ExtraError(crate::error::ExtraError),
         257  +
}
         258  +
impl ::std::fmt::Display for NullInNonSparseError {
         259  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         260  +
        match &self {
         261  +
            NullInNonSparseError::ExtraError(_inner) => _inner.fmt(f),
         262  +
        }
         263  +
    }
         264  +
}
         265  +
impl NullInNonSparseError {
         266  +
    /// Returns `true` if the error kind is `NullInNonSparseError::ExtraError`.
         267  +
    pub fn is_extra_error(&self) -> bool {
         268  +
        matches!(&self, NullInNonSparseError::ExtraError(_))
         269  +
    }
         270  +
    /// Returns the error name string by matching the correct variant.
         271  +
    pub fn name(&self) -> &'static str {
         272  +
        match &self {
         273  +
            NullInNonSparseError::ExtraError(_inner) => _inner.name(),
         274  +
        }
         275  +
    }
         276  +
}
         277  +
impl ::std::error::Error for NullInNonSparseError {
         278  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         279  +
        match &self {
         280  +
            NullInNonSparseError::ExtraError(_inner) => Some(_inner),
         281  +
        }
         282  +
    }
         283  +
}
         284  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::NullInNonSparseError {
         285  +
    fn from(variant: crate::error::ExtraError) -> crate::error::NullInNonSparseError {
         286  +
        Self::ExtraError(variant)
         287  +
    }
         288  +
}
         289  +
         290  +
/// Error type for the `EscapedStringValues` operation.
         291  +
/// Each variant represents an error that can occur for the `EscapedStringValues` operation.
         292  +
#[derive(::std::fmt::Debug)]
         293  +
pub enum EscapedStringValuesError {
         294  +
    /// 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.
         295  +
    ValidationException(crate::error::ValidationException),
         296  +
    #[allow(missing_docs)] // documentation missing in model
         297  +
    ExtraError(crate::error::ExtraError),
         298  +
}
         299  +
impl ::std::fmt::Display for EscapedStringValuesError {
         300  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         301  +
        match &self {
         302  +
            EscapedStringValuesError::ValidationException(_inner) => _inner.fmt(f),
         303  +
            EscapedStringValuesError::ExtraError(_inner) => _inner.fmt(f),
         304  +
        }
         305  +
    }
         306  +
}
         307  +
impl EscapedStringValuesError {
         308  +
    /// Returns `true` if the error kind is `EscapedStringValuesError::ValidationException`.
         309  +
    pub fn is_validation_exception(&self) -> bool {
         310  +
        matches!(&self, EscapedStringValuesError::ValidationException(_))
         311  +
    }
         312  +
    /// Returns `true` if the error kind is `EscapedStringValuesError::ExtraError`.
         313  +
    pub fn is_extra_error(&self) -> bool {
         314  +
        matches!(&self, EscapedStringValuesError::ExtraError(_))
         315  +
    }
         316  +
    /// Returns the error name string by matching the correct variant.
         317  +
    pub fn name(&self) -> &'static str {
         318  +
        match &self {
         319  +
            EscapedStringValuesError::ValidationException(_inner) => _inner.name(),
         320  +
            EscapedStringValuesError::ExtraError(_inner) => _inner.name(),
         321  +
        }
         322  +
    }
         323  +
}
         324  +
impl ::std::error::Error for EscapedStringValuesError {
         325  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         326  +
        match &self {
         327  +
            EscapedStringValuesError::ValidationException(_inner) => Some(_inner),
         328  +
            EscapedStringValuesError::ExtraError(_inner) => Some(_inner),
         329  +
        }
         330  +
    }
         331  +
}
         332  +
impl ::std::convert::From<crate::error::ValidationException>
         333  +
    for crate::error::EscapedStringValuesError
         334  +
{
         335  +
    fn from(variant: crate::error::ValidationException) -> crate::error::EscapedStringValuesError {
         336  +
        Self::ValidationException(variant)
         337  +
    }
         338  +
}
         339  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::EscapedStringValuesError {
         340  +
    fn from(variant: crate::error::ExtraError) -> crate::error::EscapedStringValuesError {
         341  +
        Self::ExtraError(variant)
         342  +
    }
         343  +
}
         344  +
         345  +
/// 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.
         346  +
#[derive(
         347  +
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::PartialEq, ::std::fmt::Debug, ::std::hash::Hash,
         348  +
)]
         349  +
pub struct ValidationException {
         350  +
    /// A summary of the validation failure.
         351  +
    pub message: ::std::string::String,
         352  +
    /// 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.
         353  +
    pub field_list: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         354  +
}
         355  +
impl ValidationException {
         356  +
    /// 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.
         357  +
    pub fn field_list(&self) -> ::std::option::Option<&[crate::model::ValidationExceptionField]> {
         358  +
        self.field_list.as_deref()
         359  +
    }
         360  +
}
         361  +
impl ValidationException {
         362  +
    /// Returns the error message.
         363  +
    pub fn message(&self) -> &str {
         364  +
        &self.message
         365  +
    }
         366  +
    #[doc(hidden)]
         367  +
    /// Returns the error name.
         368  +
    pub fn name(&self) -> &'static str {
         369  +
        "ValidationException"
         370  +
    }
         371  +
}
         372  +
impl ::std::fmt::Display for ValidationException {
         373  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         374  +
        ::std::write!(f, "ValidationException")?;
         375  +
        {
         376  +
            ::std::write!(f, ": {}", &self.message)?;
         377  +
        }
         378  +
        Ok(())
         379  +
    }
         380  +
}
         381  +
impl ::std::error::Error for ValidationException {}
         382  +
impl ValidationException {
         383  +
    /// Creates a new builder-style object to manufacture [`ValidationException`](crate::error::ValidationException).
         384  +
    pub fn builder() -> crate::error::validation_exception::Builder {
         385  +
        crate::error::validation_exception::Builder::default()
         386  +
    }
         387  +
}
         388  +
         389  +
/// Error type for the `PrimitiveIntOp` operation.
         390  +
/// Each variant represents an error that can occur for the `PrimitiveIntOp` operation.
         391  +
#[derive(::std::fmt::Debug)]
         392  +
pub enum PrimitiveIntOpError {
         393  +
    #[allow(missing_docs)] // documentation missing in model
         394  +
    ExtraError(crate::error::ExtraError),
         395  +
}
         396  +
impl ::std::fmt::Display for PrimitiveIntOpError {
         397  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         398  +
        match &self {
         399  +
            PrimitiveIntOpError::ExtraError(_inner) => _inner.fmt(f),
         400  +
        }
         401  +
    }
         402  +
}
         403  +
impl PrimitiveIntOpError {
         404  +
    /// Returns `true` if the error kind is `PrimitiveIntOpError::ExtraError`.
         405  +
    pub fn is_extra_error(&self) -> bool {
         406  +
        matches!(&self, PrimitiveIntOpError::ExtraError(_))
         407  +
    }
         408  +
    /// Returns the error name string by matching the correct variant.
         409  +
    pub fn name(&self) -> &'static str {
         410  +
        match &self {
         411  +
            PrimitiveIntOpError::ExtraError(_inner) => _inner.name(),
         412  +
        }
         413  +
    }
         414  +
}
         415  +
impl ::std::error::Error for PrimitiveIntOpError {
         416  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         417  +
        match &self {
         418  +
            PrimitiveIntOpError::ExtraError(_inner) => Some(_inner),
         419  +
        }
         420  +
    }
         421  +
}
         422  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::PrimitiveIntOpError {
         423  +
    fn from(variant: crate::error::ExtraError) -> crate::error::PrimitiveIntOpError {
         424  +
        Self::ExtraError(variant)
         425  +
    }
         426  +
}
         427  +
         428  +
/// Error type for the `MapWithEnumKeyOp` operation.
         429  +
/// Each variant represents an error that can occur for the `MapWithEnumKeyOp` operation.
         430  +
#[derive(::std::fmt::Debug)]
         431  +
pub enum MapWithEnumKeyOpError {
         432  +
    /// 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.
         433  +
    ValidationException(crate::error::ValidationException),
         434  +
    #[allow(missing_docs)] // documentation missing in model
         435  +
    ExtraError(crate::error::ExtraError),
         436  +
}
         437  +
impl ::std::fmt::Display for MapWithEnumKeyOpError {
         438  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         439  +
        match &self {
         440  +
            MapWithEnumKeyOpError::ValidationException(_inner) => _inner.fmt(f),
         441  +
            MapWithEnumKeyOpError::ExtraError(_inner) => _inner.fmt(f),
         442  +
        }
         443  +
    }
         444  +
}
         445  +
impl MapWithEnumKeyOpError {
         446  +
    /// Returns `true` if the error kind is `MapWithEnumKeyOpError::ValidationException`.
         447  +
    pub fn is_validation_exception(&self) -> bool {
         448  +
        matches!(&self, MapWithEnumKeyOpError::ValidationException(_))
         449  +
    }
         450  +
    /// Returns `true` if the error kind is `MapWithEnumKeyOpError::ExtraError`.
         451  +
    pub fn is_extra_error(&self) -> bool {
         452  +
        matches!(&self, MapWithEnumKeyOpError::ExtraError(_))
         453  +
    }
         454  +
    /// Returns the error name string by matching the correct variant.
         455  +
    pub fn name(&self) -> &'static str {
         456  +
        match &self {
         457  +
            MapWithEnumKeyOpError::ValidationException(_inner) => _inner.name(),
         458  +
            MapWithEnumKeyOpError::ExtraError(_inner) => _inner.name(),
         459  +
        }
         460  +
    }
         461  +
}
         462  +
impl ::std::error::Error for MapWithEnumKeyOpError {
         463  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         464  +
        match &self {
         465  +
            MapWithEnumKeyOpError::ValidationException(_inner) => Some(_inner),
         466  +
            MapWithEnumKeyOpError::ExtraError(_inner) => Some(_inner),
         467  +
        }
         468  +
    }
         469  +
}
         470  +
impl ::std::convert::From<crate::error::ValidationException>
         471  +
    for crate::error::MapWithEnumKeyOpError
         472  +
{
         473  +
    fn from(variant: crate::error::ValidationException) -> crate::error::MapWithEnumKeyOpError {
         474  +
        Self::ValidationException(variant)
         475  +
    }
         476  +
}
         477  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::MapWithEnumKeyOpError {
         478  +
    fn from(variant: crate::error::ExtraError) -> crate::error::MapWithEnumKeyOpError {
         479  +
        Self::ExtraError(variant)
         480  +
    }
         481  +
}
         482  +
         483  +
/// Error type for the `StatusResponse` operation.
         484  +
/// Each variant represents an error that can occur for the `StatusResponse` operation.
         485  +
#[derive(::std::fmt::Debug)]
         486  +
pub enum StatusResponseError {
         487  +
    #[allow(missing_docs)] // documentation missing in model
         488  +
    ExtraError(crate::error::ExtraError),
         489  +
}
         490  +
impl ::std::fmt::Display for StatusResponseError {
         491  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         492  +
        match &self {
         493  +
            StatusResponseError::ExtraError(_inner) => _inner.fmt(f),
         494  +
        }
         495  +
    }
         496  +
}
         497  +
impl StatusResponseError {
         498  +
    /// Returns `true` if the error kind is `StatusResponseError::ExtraError`.
         499  +
    pub fn is_extra_error(&self) -> bool {
         500  +
        matches!(&self, StatusResponseError::ExtraError(_))
         501  +
    }
         502  +
    /// Returns the error name string by matching the correct variant.
         503  +
    pub fn name(&self) -> &'static str {
         504  +
        match &self {
         505  +
            StatusResponseError::ExtraError(_inner) => _inner.name(),
         506  +
        }
         507  +
    }
         508  +
}
         509  +
impl ::std::error::Error for StatusResponseError {
         510  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         511  +
        match &self {
         512  +
            StatusResponseError::ExtraError(_inner) => Some(_inner),
         513  +
        }
         514  +
    }
         515  +
}
         516  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::StatusResponseError {
         517  +
    fn from(variant: crate::error::ExtraError) -> crate::error::StatusResponseError {
         518  +
        Self::ExtraError(variant)
         519  +
    }
         520  +
}
         521  +
         522  +
/// Error type for the `EnumQuery` operation.
         523  +
/// Each variant represents an error that can occur for the `EnumQuery` operation.
         524  +
#[derive(::std::fmt::Debug)]
         525  +
pub enum EnumQueryError {
         526  +
    /// 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.
         527  +
    ValidationException(crate::error::ValidationException),
         528  +
    #[allow(missing_docs)] // documentation missing in model
         529  +
    ExtraError(crate::error::ExtraError),
         530  +
}
         531  +
impl ::std::fmt::Display for EnumQueryError {
         532  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         533  +
        match &self {
         534  +
            EnumQueryError::ValidationException(_inner) => _inner.fmt(f),
         535  +
            EnumQueryError::ExtraError(_inner) => _inner.fmt(f),
         536  +
        }
         537  +
    }
         538  +
}
         539  +
impl EnumQueryError {
         540  +
    /// Returns `true` if the error kind is `EnumQueryError::ValidationException`.
         541  +
    pub fn is_validation_exception(&self) -> bool {
         542  +
        matches!(&self, EnumQueryError::ValidationException(_))
         543  +
    }
         544  +
    /// Returns `true` if the error kind is `EnumQueryError::ExtraError`.
         545  +
    pub fn is_extra_error(&self) -> bool {
         546  +
        matches!(&self, EnumQueryError::ExtraError(_))
         547  +
    }
         548  +
    /// Returns the error name string by matching the correct variant.
         549  +
    pub fn name(&self) -> &'static str {
         550  +
        match &self {
         551  +
            EnumQueryError::ValidationException(_inner) => _inner.name(),
         552  +
            EnumQueryError::ExtraError(_inner) => _inner.name(),
         553  +
        }
         554  +
    }
         555  +
}
         556  +
impl ::std::error::Error for EnumQueryError {
         557  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         558  +
        match &self {
         559  +
            EnumQueryError::ValidationException(_inner) => Some(_inner),
         560  +
            EnumQueryError::ExtraError(_inner) => Some(_inner),
         561  +
        }
         562  +
    }
         563  +
}
         564  +
impl ::std::convert::From<crate::error::ValidationException> for crate::error::EnumQueryError {
         565  +
    fn from(variant: crate::error::ValidationException) -> crate::error::EnumQueryError {
         566  +
        Self::ValidationException(variant)
         567  +
    }
         568  +
}
         569  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::EnumQueryError {
         570  +
    fn from(variant: crate::error::ExtraError) -> crate::error::EnumQueryError {
         571  +
        Self::ExtraError(variant)
         572  +
    }
         573  +
}
         574  +
         575  +
/// Error type for the `PrimitiveIntHeader` operation.
         576  +
/// Each variant represents an error that can occur for the `PrimitiveIntHeader` operation.
         577  +
#[derive(::std::fmt::Debug)]
         578  +
pub enum PrimitiveIntHeaderError {
         579  +
    /// 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.
         580  +
    ValidationException(crate::error::ValidationException),
         581  +
    #[allow(missing_docs)] // documentation missing in model
         582  +
    ExtraError(crate::error::ExtraError),
         583  +
}
         584  +
impl ::std::fmt::Display for PrimitiveIntHeaderError {
         585  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         586  +
        match &self {
         587  +
            PrimitiveIntHeaderError::ValidationException(_inner) => _inner.fmt(f),
         588  +
            PrimitiveIntHeaderError::ExtraError(_inner) => _inner.fmt(f),
         589  +
        }
         590  +
    }
         591  +
}
         592  +
impl PrimitiveIntHeaderError {
         593  +
    /// Returns `true` if the error kind is `PrimitiveIntHeaderError::ValidationException`.
         594  +
    pub fn is_validation_exception(&self) -> bool {
         595  +
        matches!(&self, PrimitiveIntHeaderError::ValidationException(_))
         596  +
    }
         597  +
    /// Returns `true` if the error kind is `PrimitiveIntHeaderError::ExtraError`.
         598  +
    pub fn is_extra_error(&self) -> bool {
         599  +
        matches!(&self, PrimitiveIntHeaderError::ExtraError(_))
         600  +
    }
         601  +
    /// Returns the error name string by matching the correct variant.
         602  +
    pub fn name(&self) -> &'static str {
         603  +
        match &self {
         604  +
            PrimitiveIntHeaderError::ValidationException(_inner) => _inner.name(),
         605  +
            PrimitiveIntHeaderError::ExtraError(_inner) => _inner.name(),
         606  +
        }
         607  +
    }
         608  +
}
         609  +
impl ::std::error::Error for PrimitiveIntHeaderError {
         610  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         611  +
        match &self {
         612  +
            PrimitiveIntHeaderError::ValidationException(_inner) => Some(_inner),
         613  +
            PrimitiveIntHeaderError::ExtraError(_inner) => Some(_inner),
         614  +
        }
         615  +
    }
         616  +
}
         617  +
impl ::std::convert::From<crate::error::ValidationException>
         618  +
    for crate::error::PrimitiveIntHeaderError
         619  +
{
         620  +
    fn from(variant: crate::error::ValidationException) -> crate::error::PrimitiveIntHeaderError {
         621  +
        Self::ValidationException(variant)
         622  +
    }
         623  +
}
         624  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::PrimitiveIntHeaderError {
         625  +
    fn from(variant: crate::error::ExtraError) -> crate::error::PrimitiveIntHeaderError {
         626  +
        Self::ExtraError(variant)
         627  +
    }
         628  +
}
         629  +
         630  +
/// Error type for the `StringPayload` operation.
         631  +
/// Each variant represents an error that can occur for the `StringPayload` operation.
         632  +
#[derive(::std::fmt::Debug)]
         633  +
pub enum StringPayloadError {
         634  +
    #[allow(missing_docs)] // documentation missing in model
         635  +
    ExtraError(crate::error::ExtraError),
         636  +
}
         637  +
impl ::std::fmt::Display for StringPayloadError {
         638  +
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         639  +
        match &self {
         640  +
            StringPayloadError::ExtraError(_inner) => _inner.fmt(f),
         641  +
        }
         642  +
    }
         643  +
}
         644  +
impl StringPayloadError {
         645  +
    /// Returns `true` if the error kind is `StringPayloadError::ExtraError`.
         646  +
    pub fn is_extra_error(&self) -> bool {
         647  +
        matches!(&self, StringPayloadError::ExtraError(_))
         648  +
    }
         649  +
    /// Returns the error name string by matching the correct variant.
         650  +
    pub fn name(&self) -> &'static str {
         651  +
        match &self {
         652  +
            StringPayloadError::ExtraError(_inner) => _inner.name(),
         653  +
        }
         654  +
    }
         655  +
}
         656  +
impl ::std::error::Error for StringPayloadError {
         657  +
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
         658  +
        match &self {
         659  +
            StringPayloadError::ExtraError(_inner) => Some(_inner),
         660  +
        }
         661  +
    }
         662  +
}
         663  +
impl ::std::convert::From<crate::error::ExtraError> for crate::error::StringPayloadError {
         664  +
    fn from(variant: crate::error::ExtraError) -> crate::error::StringPayloadError {
         665  +
        Self::ExtraError(variant)
         666  +
    }
         667  +
}
         668  +
/// See [`ExtraError`](crate::error::ExtraError).
         669  +
pub mod extra_error {
         670  +
         671  +
    impl ::std::convert::From<Builder> for crate::error::ExtraError {
         672  +
        fn from(builder: Builder) -> Self {
         673  +
            builder.build()
         674  +
        }
         675  +
    }
         676  +
    /// A builder for [`ExtraError`](crate::error::ExtraError).
         677  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         678  +
    pub struct Builder {}
         679  +
    impl Builder {
         680  +
        /// Consumes the builder and constructs a [`ExtraError`](crate::error::ExtraError).
         681  +
        pub fn build(self) -> crate::error::ExtraError {
         682  +
            self.build_enforcing_all_constraints()
         683  +
        }
         684  +
        fn build_enforcing_all_constraints(self) -> crate::error::ExtraError {
         685  +
            crate::error::ExtraError {}
         686  +
        }
         687  +
    }
         688  +
}
         689  +
/// See [`CaseInsensitiveError`](crate::error::CaseInsensitiveError).
         690  +
pub mod case_insensitive_error {
         691  +
         692  +
    impl ::std::convert::From<Builder> for crate::error::CaseInsensitiveError {
         693  +
        fn from(builder: Builder) -> Self {
         694  +
            builder.build()
         695  +
        }
         696  +
    }
         697  +
    /// A builder for [`CaseInsensitiveError`](crate::error::CaseInsensitiveError).
         698  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         699  +
    pub struct Builder {
         700  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
         701  +
    }
         702  +
    impl Builder {
         703  +
        #[allow(missing_docs)] // documentation missing in model
         704  +
        pub fn message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         705  +
            self.message = input;
         706  +
            self
         707  +
        }
         708  +
        /// Consumes the builder and constructs a [`CaseInsensitiveError`](crate::error::CaseInsensitiveError).
         709  +
        pub fn build(self) -> crate::error::CaseInsensitiveError {
         710  +
            self.build_enforcing_all_constraints()
         711  +
        }
         712  +
        fn build_enforcing_all_constraints(self) -> crate::error::CaseInsensitiveError {
         713  +
            crate::error::CaseInsensitiveError {
         714  +
                message: self.message,
         715  +
            }
         716  +
        }
         717  +
    }
         718  +
}
         719  +
/// See [`ValidationException`](crate::error::ValidationException).
         720  +
pub mod validation_exception {
         721  +
         722  +
    #[derive(::std::cmp::PartialEq, ::std::fmt::Debug)]
         723  +
    /// Holds one variant for each of the ways the builder can fail.
         724  +
    #[non_exhaustive]
         725  +
    #[allow(clippy::enum_variant_names)]
         726  +
    pub enum ConstraintViolation {
         727  +
        /// `message` was not provided but it is required when building `ValidationException`.
         728  +
        MissingMessage,
         729  +
    }
         730  +
    impl ::std::fmt::Display for ConstraintViolation {
         731  +
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         732  +
            match self {
         733  +
                ConstraintViolation::MissingMessage => write!(f, "`message` was not provided but it is required when building `ValidationException`"),
         734  +
            }
         735  +
        }
         736  +
    }
         737  +
    impl ::std::error::Error for ConstraintViolation {}
         738  +
    impl ::std::convert::TryFrom<Builder> for crate::error::ValidationException {
         739  +
        type Error = ConstraintViolation;
         740  +
         741  +
        fn try_from(builder: Builder) -> ::std::result::Result<Self, Self::Error> {
         742  +
            builder.build()
         743  +
        }
         744  +
    }
         745  +
    /// A builder for [`ValidationException`](crate::error::ValidationException).
         746  +
    #[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
         747  +
    pub struct Builder {
         748  +
        pub(crate) message: ::std::option::Option<::std::string::String>,
         749  +
        pub(crate) field_list:
         750  +
            ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         751  +
    }
         752  +
    impl Builder {
         753  +
        /// A summary of the validation failure.
         754  +
        pub fn message(mut self, input: ::std::string::String) -> Self {
         755  +
            self.message = Some(input);
         756  +
            self
         757  +
        }
         758  +
        /// 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.
         759  +
        pub fn field_list(
         760  +
            mut self,
         761  +
            input: ::std::option::Option<::std::vec::Vec<crate::model::ValidationExceptionField>>,
         762  +
        ) -> Self {
         763  +
            self.field_list = input;
         764  +
            self
         765  +
        }
         766  +
        /// Consumes the builder and constructs a [`ValidationException`](crate::error::ValidationException).
         767  +
        ///
         768  +
        /// The builder fails to construct a [`ValidationException`](crate::error::ValidationException) if a [`ConstraintViolation`] occurs.
         769  +
        ///
         770  +
        pub fn build(self) -> Result<crate::error::ValidationException, ConstraintViolation> {
         771  +
            self.build_enforcing_all_constraints()
         772  +
        }
         773  +
        fn build_enforcing_all_constraints(
         774  +
            self,
         775  +
        ) -> Result<crate::error::ValidationException, ConstraintViolation> {
         776  +
            Ok(crate::error::ValidationException {
         777  +
                message: self.message.ok_or(ConstraintViolation::MissingMessage)?,
         778  +
                field_list: self.field_list,
         779  +
            })
         780  +
        }
         781  +
    }
         782  +
}