Client Test

Client Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +94,173 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct Dialog {
           8  +
pub /* StructureGenerator.kt:201 */ struct Dialog {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub language: ::std::option::Option<::std::string::String>,
    8         -
    #[allow(missing_docs)] // documentation missing in model
          12  +
    /* StructureGenerator.kt:231 */ #[allow(missing_docs)] // documentation missing in model
    9     13   
    pub greeting: ::std::string::String,
          14  +
    /* StructureGenerator.kt:231 */
   10     15   
    #[allow(missing_docs)] // documentation missing in model
   11     16   
    pub farewell: ::std::option::Option<crate::types::Farewell>,
          17  +
    /* StructureGenerator.kt:201 */
   12     18   
}
          19  +
/* StructureGenerator.kt:135 */
   13     20   
impl Dialog {
          21  +
    /* StructureGenerator.kt:231 */
   14     22   
    #[allow(missing_docs)] // documentation missing in model
          23  +
                           /* StructureGenerator.kt:166 */
   15     24   
    pub fn language(&self) -> ::std::option::Option<&str> {
          25  +
        /* StructureGenerator.kt:169 */
   16     26   
        self.language.as_deref()
          27  +
        /* StructureGenerator.kt:166 */
   17     28   
    }
          29  +
    /* StructureGenerator.kt:231 */
   18     30   
    #[allow(missing_docs)] // documentation missing in model
          31  +
                           /* StructureGenerator.kt:166 */
   19     32   
    pub fn greeting(&self) -> &str {
          33  +
        /* StructureGenerator.kt:171 */
   20     34   
        use std::ops::Deref;
   21     35   
        self.greeting.deref()
          36  +
        /* StructureGenerator.kt:166 */
   22     37   
    }
          38  +
    /* StructureGenerator.kt:231 */
   23     39   
    #[allow(missing_docs)] // documentation missing in model
          40  +
                           /* StructureGenerator.kt:166 */
   24     41   
    pub fn farewell(&self) -> ::std::option::Option<&crate::types::Farewell> {
          42  +
        /* StructureGenerator.kt:170 */
   25     43   
        self.farewell.as_ref()
          44  +
        /* StructureGenerator.kt:166 */
   26     45   
    }
          46  +
    /* StructureGenerator.kt:135 */
   27     47   
}
          48  +
/* ClientCodegenVisitor.kt:237 */
   28     49   
impl Dialog {
   29         -
    /// Creates a new builder-style object to manufacture [`Dialog`](crate::types::Dialog).
          50  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`Dialog`](crate::types::Dialog).
          51  +
    /* BuilderGenerator.kt:175 */
   30     52   
    pub fn builder() -> crate::types::builders::DialogBuilder {
          53  +
        /* BuilderGenerator.kt:176 */
   31     54   
        crate::types::builders::DialogBuilder::default()
          55  +
        /* BuilderGenerator.kt:175 */
   32     56   
    }
          57  +
    /* ClientCodegenVisitor.kt:237 */
   33     58   
}
   34     59   
   35         -
/// A builder for [`Dialog`](crate::types::Dialog).
          60  +
/// /* BuilderGenerator.kt:342 */A builder for [`Dialog`](crate::types::Dialog).
          61  +
/* RustType.kt:516 */
   36     62   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          63  +
/* RustType.kt:516 */
   37     64   
#[non_exhaustive]
          65  +
/* BuilderGenerator.kt:345 */
   38     66   
pub struct DialogBuilder {
   39         -
    pub(crate) language: ::std::option::Option<::std::string::String>,
   40         -
    pub(crate) greeting: ::std::option::Option<::std::string::String>,
   41         -
    pub(crate) farewell: ::std::option::Option<crate::types::Farewell>,
          67  +
    /* BuilderGenerator.kt:275 */ pub(crate) language: ::std::option::Option<::std::string::String>,
          68  +
    /* BuilderGenerator.kt:275 */ pub(crate) greeting: ::std::option::Option<::std::string::String>,
          69  +
    /* BuilderGenerator.kt:275 */ pub(crate) farewell: ::std::option::Option<crate::types::Farewell>,
          70  +
    /* BuilderGenerator.kt:345 */
   42     71   
}
          72  +
/* BuilderGenerator.kt:355 */
   43     73   
impl DialogBuilder {
          74  +
    /* BuilderGenerator.kt:286 */
   44     75   
    #[allow(missing_docs)] // documentation missing in model
          76  +
                           /* BuilderGenerator.kt:291 */
   45     77   
    pub fn language(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          78  +
        /* BuilderGenerator.kt:292 */
   46     79   
        self.language = ::std::option::Option::Some(input.into());
          80  +
        /* BuilderGenerator.kt:293 */
   47     81   
        self
          82  +
        /* BuilderGenerator.kt:291 */
   48     83   
    }
          84  +
    /* BuilderGenerator.kt:312 */
   49     85   
    #[allow(missing_docs)] // documentation missing in model
          86  +
                           /* BuilderGenerator.kt:314 */
   50     87   
    pub fn set_language(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          88  +
        /* BuilderGenerator.kt:315 */
   51     89   
        self.language = input;
   52     90   
        self
          91  +
        /* BuilderGenerator.kt:314 */
   53     92   
    }
          93  +
    /* BuilderGenerator.kt:334 */
   54     94   
    #[allow(missing_docs)] // documentation missing in model
          95  +
                           /* BuilderGenerator.kt:336 */
   55     96   
    pub fn get_language(&self) -> &::std::option::Option<::std::string::String> {
          97  +
        /* BuilderGenerator.kt:337 */
   56     98   
        &self.language
          99  +
        /* BuilderGenerator.kt:336 */
   57    100   
    }
         101  +
    /* BuilderGenerator.kt:286 */
   58    102   
    #[allow(missing_docs)] // documentation missing in model
         103  +
                           /* BuilderGenerator.kt:291 */
   59    104   
    pub fn greeting(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
         105  +
        /* BuilderGenerator.kt:292 */
   60    106   
        self.greeting = ::std::option::Option::Some(input.into());
         107  +
        /* BuilderGenerator.kt:293 */
   61    108   
        self
         109  +
        /* BuilderGenerator.kt:291 */
   62    110   
    }
         111  +
    /* BuilderGenerator.kt:312 */
   63    112   
    #[allow(missing_docs)] // documentation missing in model
         113  +
                           /* BuilderGenerator.kt:314 */
   64    114   
    pub fn set_greeting(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         115  +
        /* BuilderGenerator.kt:315 */
   65    116   
        self.greeting = input;
   66    117   
        self
         118  +
        /* BuilderGenerator.kt:314 */
   67    119   
    }
         120  +
    /* BuilderGenerator.kt:334 */
   68    121   
    #[allow(missing_docs)] // documentation missing in model
         122  +
                           /* BuilderGenerator.kt:336 */
   69    123   
    pub fn get_greeting(&self) -> &::std::option::Option<::std::string::String> {
         124  +
        /* BuilderGenerator.kt:337 */
   70    125   
        &self.greeting
         126  +
        /* BuilderGenerator.kt:336 */
   71    127   
    }
         128  +
    /* BuilderGenerator.kt:286 */
   72    129   
    #[allow(missing_docs)] // documentation missing in model
         130  +
                           /* BuilderGenerator.kt:291 */
   73    131   
    pub fn farewell(mut self, input: crate::types::Farewell) -> Self {
         132  +
        /* BuilderGenerator.kt:292 */
   74    133   
        self.farewell = ::std::option::Option::Some(input);
         134  +
        /* BuilderGenerator.kt:293 */
   75    135   
        self
         136  +
        /* BuilderGenerator.kt:291 */
   76    137   
    }
         138  +
    /* BuilderGenerator.kt:312 */
   77    139   
    #[allow(missing_docs)] // documentation missing in model
         140  +
                           /* BuilderGenerator.kt:314 */
   78    141   
    pub fn set_farewell(mut self, input: ::std::option::Option<crate::types::Farewell>) -> Self {
         142  +
        /* BuilderGenerator.kt:315 */
   79    143   
        self.farewell = input;
   80    144   
        self
         145  +
        /* BuilderGenerator.kt:314 */
   81    146   
    }
         147  +
    /* BuilderGenerator.kt:334 */
   82    148   
    #[allow(missing_docs)] // documentation missing in model
         149  +
                           /* BuilderGenerator.kt:336 */
   83    150   
    pub fn get_farewell(&self) -> &::std::option::Option<crate::types::Farewell> {
         151  +
        /* BuilderGenerator.kt:337 */
   84    152   
        &self.farewell
         153  +
        /* BuilderGenerator.kt:336 */
   85    154   
    }
   86         -
    /// Consumes the builder and constructs a [`Dialog`](crate::types::Dialog).
         155  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`Dialog`](crate::types::Dialog).
         156  +
    /* BuilderGenerator.kt:253 */
   87    157   
    pub fn build(self) -> crate::types::Dialog {
         158  +
        /* BuilderGenerator.kt:477 */
   88    159   
        crate::types::Dialog {
   89         -
            language: self.language,
   90         -
            greeting: self.greeting.unwrap_or_else(|| "hi".to_owned()),
         160  +
            /* BuilderGenerator.kt:481 */ language: self.language,
         161  +
            /* BuilderGenerator.kt:481 */
         162  +
            greeting: self
         163  +
                .greeting
         164  +
                /* BuilderGenerator.kt:489 */
         165  +
                .unwrap_or_else(|| "hi".to_owned()),
         166  +
            /* BuilderGenerator.kt:481 */
   91    167   
            farewell: self.farewell,
         168  +
            /* BuilderGenerator.kt:477 */
   92    169   
        }
         170  +
        /* BuilderGenerator.kt:253 */
   93    171   
    }
         172  +
    /* BuilderGenerator.kt:355 */
   94    173   
}

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

@@ -1,1 +50,93 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct Farewell {
           8  +
pub /* StructureGenerator.kt:201 */ struct Farewell {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub phrase: ::std::string::String,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl Farewell {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn phrase(&self) -> &str {
          20  +
        /* StructureGenerator.kt:171 */
   12     21   
        use std::ops::Deref;
   13     22   
        self.phrase.deref()
          23  +
        /* StructureGenerator.kt:166 */
   14     24   
    }
          25  +
    /* StructureGenerator.kt:135 */
   15     26   
}
          27  +
/* ClientCodegenVisitor.kt:237 */
   16     28   
impl Farewell {
   17         -
    /// Creates a new builder-style object to manufacture [`Farewell`](crate::types::Farewell).
          29  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`Farewell`](crate::types::Farewell).
          30  +
    /* BuilderGenerator.kt:175 */
   18     31   
    pub fn builder() -> crate::types::builders::FarewellBuilder {
          32  +
        /* BuilderGenerator.kt:176 */
   19     33   
        crate::types::builders::FarewellBuilder::default()
          34  +
        /* BuilderGenerator.kt:175 */
   20     35   
    }
          36  +
    /* ClientCodegenVisitor.kt:237 */
   21     37   
}
   22     38   
   23         -
/// A builder for [`Farewell`](crate::types::Farewell).
          39  +
/// /* BuilderGenerator.kt:342 */A builder for [`Farewell`](crate::types::Farewell).
          40  +
/* RustType.kt:516 */
   24     41   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          42  +
/* RustType.kt:516 */
   25     43   
#[non_exhaustive]
          44  +
/* BuilderGenerator.kt:345 */
   26     45   
pub struct FarewellBuilder {
   27         -
    pub(crate) phrase: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:275 */ pub(crate) phrase: ::std::option::Option<::std::string::String>,
          47  +
    /* BuilderGenerator.kt:345 */
   28     48   
}
          49  +
/* BuilderGenerator.kt:355 */
   29     50   
impl FarewellBuilder {
          51  +
    /* BuilderGenerator.kt:286 */
   30     52   
    #[allow(missing_docs)] // documentation missing in model
          53  +
                           /* BuilderGenerator.kt:291 */
   31     54   
    pub fn phrase(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          55  +
        /* BuilderGenerator.kt:292 */
   32     56   
        self.phrase = ::std::option::Option::Some(input.into());
          57  +
        /* BuilderGenerator.kt:293 */
   33     58   
        self
          59  +
        /* BuilderGenerator.kt:291 */
   34     60   
    }
          61  +
    /* BuilderGenerator.kt:312 */
   35     62   
    #[allow(missing_docs)] // documentation missing in model
          63  +
                           /* BuilderGenerator.kt:314 */
   36     64   
    pub fn set_phrase(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          65  +
        /* BuilderGenerator.kt:315 */
   37     66   
        self.phrase = input;
   38     67   
        self
          68  +
        /* BuilderGenerator.kt:314 */
   39     69   
    }
          70  +
    /* BuilderGenerator.kt:334 */
   40     71   
    #[allow(missing_docs)] // documentation missing in model
          72  +
                           /* BuilderGenerator.kt:336 */
   41     73   
    pub fn get_phrase(&self) -> &::std::option::Option<::std::string::String> {
          74  +
        /* BuilderGenerator.kt:337 */
   42     75   
        &self.phrase
          76  +
        /* BuilderGenerator.kt:336 */
   43     77   
    }
   44         -
    /// Consumes the builder and constructs a [`Farewell`](crate::types::Farewell).
          78  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`Farewell`](crate::types::Farewell).
          79  +
    /* BuilderGenerator.kt:253 */
   45     80   
    pub fn build(self) -> crate::types::Farewell {
          81  +
        /* BuilderGenerator.kt:477 */
   46     82   
        crate::types::Farewell {
   47         -
            phrase: self.phrase.unwrap_or_else(|| "bye".to_owned()),
          83  +
            /* BuilderGenerator.kt:481 */
          84  +
            phrase: self
          85  +
                .phrase
          86  +
                /* BuilderGenerator.kt:489 */
          87  +
                .unwrap_or_else(|| "bye".to_owned()),
          88  +
            /* BuilderGenerator.kt:477 */
   48     89   
        }
          90  +
        /* BuilderGenerator.kt:253 */
   49     91   
    }
          92  +
    /* BuilderGenerator.kt:355 */
   50     93   
}

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

@@ -1,1 +126,152 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `FooEnum`, it is important to ensure
           2  +
/* ClientEnumGenerator.kt:234 */
           3  +
/// /* ClientEnumGenerator.kt:234 */When writing a match expression against `FooEnum`, it is important to ensure
    4      4   
/// your code is forward-compatible. That is, if a match arm handles a case for a
    5      5   
/// feature that is supported by the service but has not been represented as an enum
    6      6   
/// variant in a current version of SDK, your code should continue to work when you
    7      7   
/// upgrade SDK to a future version in which the enum does include a variant for that
    8      8   
/// feature.
    9         -
///
   10         -
/// Here is an example of how you can make a match expression forward-compatible:
   11         -
///
   12         -
/// ```text
           9  +
/// /* ClientEnumGenerator.kt:244 */
          10  +
/// /* ClientEnumGenerator.kt:245 */Here is an example of how you can make a match expression forward-compatible:
          11  +
/// /* ClientEnumGenerator.kt:246 */
          12  +
/// /* ClientEnumGenerator.kt:247 */```text
          13  +
/* ClientEnumGenerator.kt:248 */
   13     14   
/// # let fooenum = unimplemented!();
          15  +
/* ClientEnumGenerator.kt:249 */
   14     16   
/// match fooenum {
          17  +
/* ClientEnumGenerator.kt:251 */
   15     18   
///     FooEnum::Zero => { /* ... */ },
          19  +
/* ClientEnumGenerator.kt:251 */
   16     20   
///     FooEnum::One => { /* ... */ },
          21  +
/* ClientEnumGenerator.kt:251 */
   17     22   
///     FooEnum::Bar => { /* ... */ },
          23  +
/* ClientEnumGenerator.kt:251 */
   18     24   
///     FooEnum::Baz => { /* ... */ },
          25  +
/* ClientEnumGenerator.kt:251 */
   19     26   
///     FooEnum::Foo => { /* ... */ },
          27  +
/* ClientEnumGenerator.kt:253 */
   20     28   
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          29  +
/* ClientEnumGenerator.kt:254 */
   21     30   
///     _ => { /* ... */ },
          31  +
/* ClientEnumGenerator.kt:255 */
   22     32   
/// }
   23         -
/// ```
   24         -
/// The above code demonstrates that when `fooenum` represents
          33  +
/// /* ClientEnumGenerator.kt:256 */```
          34  +
/// /* ClientEnumGenerator.kt:257 */The above code demonstrates that when `fooenum` represents
   25     35   
/// `NewFeature`, the execution path will lead to the second last match arm,
   26     36   
/// even though the enum does not contain a variant `FooEnum::NewFeature`
   27     37   
/// in the current version of SDK. The reason is that the variable `other`,
   28     38   
/// created by the `@` operator, is bound to
   29     39   
/// `FooEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
   30     40   
/// and calling `as_str` on it yields `"NewFeature"`.
   31     41   
/// This match expression is forward-compatible when executed with a newer
   32     42   
/// version of SDK where the variant `FooEnum::NewFeature` is defined.
   33     43   
/// Specifically, when `fooenum` represents `NewFeature`,
   34     44   
/// the execution path will hit the second last match arm as before by virtue of
   35     45   
/// calling `as_str` on `FooEnum::NewFeature` also yielding `"NewFeature"`.
   36         -
///
   37         -
/// Explicitly matching on the `Unknown` variant should
          46  +
/// /* ClientEnumGenerator.kt:273 */
          47  +
/// /* ClientEnumGenerator.kt:274 */Explicitly matching on the `Unknown` variant should
   38     48   
/// be avoided for two reasons:
   39     49   
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
   40     50   
/// - It might inadvertently shadow other intended match arms.
   41         -
///
          51  +
/// /* ClientEnumGenerator.kt:282 */
          52  +
/* EnumGenerator.kt:154 */
   42     53   
#[allow(missing_docs)] // documentation missing in model
          54  +
/* RustType.kt:516 */
   43     55   
#[non_exhaustive]
          56  +
/* RustType.kt:516 */
   44     57   
#[derive(
   45     58   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
   46     59   
)]
   47         -
pub enum FooEnum {
   48         -
    #[allow(missing_docs)] // documentation missing in model
          60  +
pub /* EnumGenerator.kt:267 */ enum FooEnum {
          61  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          62  +
    /* EnumGenerator.kt:143 */
   49     63   
    Zero,
   50         -
    #[allow(missing_docs)] // documentation missing in model
          64  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          65  +
    /* EnumGenerator.kt:143 */
   51     66   
    One,
   52         -
    #[allow(missing_docs)] // documentation missing in model
          67  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          68  +
    /* EnumGenerator.kt:143 */
   53     69   
    Bar,
   54         -
    #[allow(missing_docs)] // documentation missing in model
          70  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          71  +
    /* EnumGenerator.kt:143 */
   55     72   
    Baz,
   56         -
    #[allow(missing_docs)] // documentation missing in model
          73  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          74  +
    /* EnumGenerator.kt:143 */
   57     75   
    Foo,
   58         -
    /// `Unknown` contains new variants that have been added since this code was generated.
          76  +
    /// /* ClientEnumGenerator.kt:175 */`Unknown` contains new variants that have been added since this code was generated.
          77  +
    /* ClientEnumGenerator.kt:176 */
   59     78   
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
   60         -
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          79  +
    /* ClientEnumGenerator.kt:179 */
          80  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue), /* EnumGenerator.kt:267 */
   61     81   
}
          82  +
/* ClientEnumGenerator.kt:42 */
   62     83   
impl ::std::convert::From<&str> for FooEnum {
   63     84   
    fn from(s: &str) -> Self {
   64     85   
        match s {
   65     86   
            "0" => FooEnum::Zero,
   66     87   
            "1" => FooEnum::One,
   67     88   
            "Bar" => FooEnum::Bar,
   68     89   
            "Baz" => FooEnum::Baz,
   69     90   
            "Foo" => FooEnum::Foo,
   70     91   
            other => FooEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   71     92   
        }
   72     93   
    }
   73     94   
}
          95  +
/* ClientEnumGenerator.kt:68 */
   74     96   
impl ::std::str::FromStr for FooEnum {
   75     97   
    type Err = ::std::convert::Infallible;
   76     98   
   77     99   
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
   78    100   
        ::std::result::Result::Ok(FooEnum::from(s))
   79    101   
    }
   80    102   
}
         103  +
/* EnumGenerator.kt:274 */
   81    104   
impl FooEnum {
   82    105   
    /// Returns the `&str` value of the enum member.
   83    106   
    pub fn as_str(&self) -> &str {
   84    107   
        match self {
   85    108   
            FooEnum::Zero => "0",
   86    109   
            FooEnum::One => "1",
   87    110   
            FooEnum::Bar => "Bar",
   88    111   
            FooEnum::Baz => "Baz",
   89    112   
            FooEnum::Foo => "Foo",
   90    113   
            FooEnum::Unknown(value) => value.as_str(),
   91    114   
        }
   92    115   
    }
   93    116   
    /// Returns all the `&str` representations of the enum members.
   94    117   
    pub const fn values() -> &'static [&'static str] {
   95    118   
        &["0", "1", "Bar", "Baz", "Foo"]
   96    119   
    }
   97    120   
}
         121  +
/* EnumGenerator.kt:223 */
   98    122   
impl ::std::convert::AsRef<str> for FooEnum {
   99    123   
    fn as_ref(&self) -> &str {
  100    124   
        self.as_str()
  101    125   
    }
  102    126   
}
         127  +
/* ClientEnumGenerator.kt:117 */
  103    128   
impl FooEnum {
  104    129   
    /// Parses the enum value while disallowing unknown variants.
  105    130   
    ///
  106    131   
    /// Unknown variants will result in an error.
  107    132   
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
  108    133   
        match Self::from(value) {
  109    134   
            #[allow(deprecated)]
  110    135   
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
  111    136   
            known => Ok(known),
  112    137   
        }
  113    138   
    }
  114    139   
}
         140  +
/* ClientEnumGenerator.kt:136 */
  115    141   
impl ::std::fmt::Display for FooEnum {
  116    142   
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  117    143   
        match self {
  118    144   
            FooEnum::Zero => write!(f, "0"),
  119    145   
            FooEnum::One => write!(f, "1"),
  120    146   
            FooEnum::Bar => write!(f, "Bar"),
  121    147   
            FooEnum::Baz => write!(f, "Baz"),
  122    148   
            FooEnum::Foo => write!(f, "Foo"),
  123    149   
            FooEnum::Unknown(value) => write!(f, "{}", value),
  124    150   
        }

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

@@ -1,1 +47,88 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct GreetingStruct {
           8  +
pub /* StructureGenerator.kt:201 */ struct GreetingStruct {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub hi: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl GreetingStruct {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn hi(&self) -> ::std::option::Option<&str> {
          20  +
        /* StructureGenerator.kt:169 */
   12     21   
        self.hi.as_deref()
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl GreetingStruct {
   16         -
    /// Creates a new builder-style object to manufacture [`GreetingStruct`](crate::types::GreetingStruct).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`GreetingStruct`](crate::types::GreetingStruct).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::types::builders::GreetingStructBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::types::builders::GreetingStructBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`GreetingStruct`](crate::types::GreetingStruct).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`GreetingStruct`](crate::types::GreetingStruct).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct GreetingStructBuilder {
   26         -
    pub(crate) hi: ::std::option::Option<::std::string::String>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) hi: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl GreetingStructBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn hi(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.hi = ::std::option::Option::Some(input.into());
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_hi(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.hi = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_hi(&self) -> &::std::option::Option<::std::string::String> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.hi
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`GreetingStruct`](crate::types::GreetingStruct).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`GreetingStruct`](crate::types::GreetingStruct).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> crate::types::GreetingStruct {
   45         -
        crate::types::GreetingStruct { hi: self.hi }
          80  +
        /* BuilderGenerator.kt:477 */
          81  +
        crate::types::GreetingStruct {
          82  +
            /* BuilderGenerator.kt:481 */ hi: self.hi,
          83  +
            /* BuilderGenerator.kt:477 */
   46     84   
        }
          85  +
        /* BuilderGenerator.kt:253 */
          86  +
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

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

@@ -1,1 +172,298 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// A union with a representative set of types for members.
           2  +
/* UnionGenerator.kt:67 */
           3  +
/// /* UnionGenerator.kt:67 */A union with a representative set of types for members.
           4  +
/* RustType.kt:516 */
    4      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    5      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    6         -
pub enum MyUnion {
           8  +
pub /* UnionGenerator.kt:85 */ enum MyUnion {
           9  +
    /* UnionGenerator.kt:90 */
    7     10   
    #[allow(missing_docs)] // documentation missing in model
          11  +
    /* UnionGenerator.kt:190 */
    8     12   
    BlobValue(::aws_smithy_types::Blob),
          13  +
    /* UnionGenerator.kt:90 */
    9     14   
    #[allow(missing_docs)] // documentation missing in model
          15  +
    /* UnionGenerator.kt:190 */
   10     16   
    BooleanValue(bool),
          17  +
    /* UnionGenerator.kt:90 */
   11     18   
    #[allow(missing_docs)] // documentation missing in model
          19  +
    /* UnionGenerator.kt:190 */
   12     20   
    EnumValue(crate::types::FooEnum),
          21  +
    /* UnionGenerator.kt:90 */
   13     22   
    #[allow(missing_docs)] // documentation missing in model
          23  +
    /* UnionGenerator.kt:190 */
   14     24   
    ListValue(::std::vec::Vec<::std::string::String>),
          25  +
    /* UnionGenerator.kt:90 */
   15     26   
    #[allow(missing_docs)] // documentation missing in model
          27  +
    /* UnionGenerator.kt:190 */
   16     28   
    MapValue(::std::collections::HashMap<::std::string::String, ::std::string::String>),
   17         -
    #[allow(missing_docs)] // documentation missing in model
          29  +
    /* UnionGenerator.kt:90 */ #[allow(missing_docs)] // documentation missing in model
          30  +
    /* UnionGenerator.kt:190 */
   18     31   
    NumberValue(i32),
          32  +
    /* UnionGenerator.kt:90 */
   19     33   
    #[allow(missing_docs)] // documentation missing in model
          34  +
    /* UnionGenerator.kt:190 */
   20     35   
    RenamedStructureValue(crate::types::RenamedGreeting),
          36  +
    /* UnionGenerator.kt:90 */
   21     37   
    #[allow(missing_docs)] // documentation missing in model
          38  +
    /* UnionGenerator.kt:190 */
   22     39   
    StringValue(::std::string::String),
          40  +
    /* UnionGenerator.kt:90 */
   23     41   
    #[allow(missing_docs)] // documentation missing in model
          42  +
    /* UnionGenerator.kt:190 */
   24     43   
    StructureValue(crate::types::GreetingStruct),
          44  +
    /* UnionGenerator.kt:90 */
   25     45   
    #[allow(missing_docs)] // documentation missing in model
          46  +
    /* UnionGenerator.kt:190 */
   26     47   
    TimestampValue(::aws_smithy_types::DateTime),
   27         -
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          48  +
    /// /* UnionGenerator.kt:96 */The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          49  +
    /* UnionGenerator.kt:97 */
   28     50   
    /// An unknown enum variant
          51  +
    /* UnionGenerator.kt:98 */
   29     52   
    ///
          53  +
    /* UnionGenerator.kt:99 */
   30     54   
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          55  +
    /* UnionGenerator.kt:100 */
   31     56   
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          57  +
    /* UnionGenerator.kt:101 */
   32     58   
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          59  +
    /* UnionGenerator.kt:102 */
   33     60   
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          61  +
    /* RustType.kt:516 */
   34     62   
    #[non_exhaustive]
          63  +
    /* UnionGenerator.kt:105 */
   35     64   
    Unknown,
          65  +
    /* UnionGenerator.kt:85 */
   36     66   
}
          67  +
/* UnionGenerator.kt:111 */
   37     68   
impl MyUnion {
          69  +
    /* UnionGenerator.kt:217 */
   38     70   
    /// Tries to convert the enum instance into [`BlobValue`](crate::types::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
          71  +
    /* UnionGenerator.kt:222 */
   39     72   
    /// Returns `Err(&Self)` if it can't be converted.
          73  +
    /* UnionGenerator.kt:223 */
   40     74   
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
          75  +
        /* UnionGenerator.kt:227 */
   41     76   
        if let MyUnion::BlobValue(val) = &self {
   42     77   
            ::std::result::Result::Ok(val)
   43     78   
        } else {
   44     79   
            ::std::result::Result::Err(self)
   45     80   
        }
          81  +
        /* UnionGenerator.kt:223 */
   46     82   
    }
          83  +
    /* UnionGenerator.kt:121 */
   47     84   
    /// Returns true if this is a [`BlobValue`](crate::types::MyUnion::BlobValue).
          85  +
    /* UnionGenerator.kt:122 */
   48     86   
    pub fn is_blob_value(&self) -> bool {
          87  +
        /* UnionGenerator.kt:123 */
   49     88   
        self.as_blob_value().is_ok()
          89  +
        /* UnionGenerator.kt:122 */
   50     90   
    }
          91  +
    /* UnionGenerator.kt:217 */
   51     92   
    /// Tries to convert the enum instance into [`BooleanValue`](crate::types::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
          93  +
    /* UnionGenerator.kt:222 */
   52     94   
    /// Returns `Err(&Self)` if it can't be converted.
          95  +
    /* UnionGenerator.kt:223 */
   53     96   
    pub fn as_boolean_value(&self) -> ::std::result::Result<&bool, &Self> {
          97  +
        /* UnionGenerator.kt:227 */
   54     98   
        if let MyUnion::BooleanValue(val) = &self {
   55     99   
            ::std::result::Result::Ok(val)
   56    100   
        } else {
   57    101   
            ::std::result::Result::Err(self)
   58    102   
        }
         103  +
        /* UnionGenerator.kt:223 */
   59    104   
    }
         105  +
    /* UnionGenerator.kt:121 */
   60    106   
    /// Returns true if this is a [`BooleanValue`](crate::types::MyUnion::BooleanValue).
         107  +
    /* UnionGenerator.kt:122 */
   61    108   
    pub fn is_boolean_value(&self) -> bool {
         109  +
        /* UnionGenerator.kt:123 */
   62    110   
        self.as_boolean_value().is_ok()
         111  +
        /* UnionGenerator.kt:122 */
   63    112   
    }
         113  +
    /* UnionGenerator.kt:217 */
   64    114   
    /// Tries to convert the enum instance into [`EnumValue`](crate::types::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::types::FooEnum).
         115  +
    /* UnionGenerator.kt:222 */
   65    116   
    /// Returns `Err(&Self)` if it can't be converted.
         117  +
    /* UnionGenerator.kt:223 */
   66    118   
    pub fn as_enum_value(&self) -> ::std::result::Result<&crate::types::FooEnum, &Self> {
         119  +
        /* UnionGenerator.kt:227 */
   67    120   
        if let MyUnion::EnumValue(val) = &self {
   68    121   
            ::std::result::Result::Ok(val)
   69    122   
        } else {
   70    123   
            ::std::result::Result::Err(self)
   71    124   
        }
         125  +
        /* UnionGenerator.kt:223 */
   72    126   
    }
         127  +
    /* UnionGenerator.kt:121 */
   73    128   
    /// Returns true if this is a [`EnumValue`](crate::types::MyUnion::EnumValue).
         129  +
    /* UnionGenerator.kt:122 */
   74    130   
    pub fn is_enum_value(&self) -> bool {
         131  +
        /* UnionGenerator.kt:123 */
   75    132   
        self.as_enum_value().is_ok()
         133  +
        /* UnionGenerator.kt:122 */
   76    134   
    }
         135  +
    /* UnionGenerator.kt:217 */
   77    136   
    /// Tries to convert the enum instance into [`ListValue`](crate::types::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
         137  +
    /* UnionGenerator.kt:222 */
   78    138   
    /// Returns `Err(&Self)` if it can't be converted.
         139  +
    /* UnionGenerator.kt:223 */
   79    140   
    pub fn as_list_value(&self) -> ::std::result::Result<&::std::vec::Vec<::std::string::String>, &Self> {
         141  +
        /* UnionGenerator.kt:227 */
   80    142   
        if let MyUnion::ListValue(val) = &self {
   81    143   
            ::std::result::Result::Ok(val)
   82    144   
        } else {
   83    145   
            ::std::result::Result::Err(self)
   84    146   
        }
         147  +
        /* UnionGenerator.kt:223 */
   85    148   
    }
         149  +
    /* UnionGenerator.kt:121 */
   86    150   
    /// Returns true if this is a [`ListValue`](crate::types::MyUnion::ListValue).
         151  +
    /* UnionGenerator.kt:122 */
   87    152   
    pub fn is_list_value(&self) -> bool {
         153  +
        /* UnionGenerator.kt:123 */
   88    154   
        self.as_list_value().is_ok()
         155  +
        /* UnionGenerator.kt:122 */
   89    156   
    }
         157  +
    /* UnionGenerator.kt:217 */
   90    158   
    /// Tries to convert the enum instance into [`MapValue`](crate::types::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
         159  +
    /* UnionGenerator.kt:222 */
   91    160   
    /// Returns `Err(&Self)` if it can't be converted.
         161  +
    /* UnionGenerator.kt:223 */
   92    162   
    pub fn as_map_value(&self) -> ::std::result::Result<&::std::collections::HashMap<::std::string::String, ::std::string::String>, &Self> {
         163  +
        /* UnionGenerator.kt:227 */
   93    164   
        if let MyUnion::MapValue(val) = &self {
   94    165   
            ::std::result::Result::Ok(val)
   95    166   
        } else {
   96    167   
            ::std::result::Result::Err(self)
   97    168   
        }
         169  +
        /* UnionGenerator.kt:223 */
   98    170   
    }
         171  +
    /* UnionGenerator.kt:121 */
   99    172   
    /// Returns true if this is a [`MapValue`](crate::types::MyUnion::MapValue).
         173  +
    /* UnionGenerator.kt:122 */
  100    174   
    pub fn is_map_value(&self) -> bool {
         175  +
        /* UnionGenerator.kt:123 */
  101    176   
        self.as_map_value().is_ok()
         177  +
        /* UnionGenerator.kt:122 */
  102    178   
    }
         179  +
    /* UnionGenerator.kt:217 */
  103    180   
    /// Tries to convert the enum instance into [`NumberValue`](crate::types::MyUnion::NumberValue), extracting the inner [`i32`](i32).
         181  +
    /* UnionGenerator.kt:222 */
  104    182   
    /// Returns `Err(&Self)` if it can't be converted.
         183  +
    /* UnionGenerator.kt:223 */
  105    184   
    pub fn as_number_value(&self) -> ::std::result::Result<&i32, &Self> {
         185  +
        /* UnionGenerator.kt:227 */
  106    186   
        if let MyUnion::NumberValue(val) = &self {
  107    187   
            ::std::result::Result::Ok(val)
  108    188   
        } else {
  109    189   
            ::std::result::Result::Err(self)
  110    190   
        }
         191  +
        /* UnionGenerator.kt:223 */
  111    192   
    }
         193  +
    /* UnionGenerator.kt:121 */
  112    194   
    /// Returns true if this is a [`NumberValue`](crate::types::MyUnion::NumberValue).
         195  +
    /* UnionGenerator.kt:122 */
  113    196   
    pub fn is_number_value(&self) -> bool {
         197  +
        /* UnionGenerator.kt:123 */
  114    198   
        self.as_number_value().is_ok()
         199  +
        /* UnionGenerator.kt:122 */
  115    200   
    }
         201  +
    /* UnionGenerator.kt:217 */
  116    202   
    /// Tries to convert the enum instance into [`RenamedStructureValue`](crate::types::MyUnion::RenamedStructureValue), extracting the inner [`RenamedGreeting`](crate::types::RenamedGreeting).
         203  +
    /* UnionGenerator.kt:222 */
  117    204   
    /// Returns `Err(&Self)` if it can't be converted.
         205  +
    /* UnionGenerator.kt:223 */
  118    206   
    pub fn as_renamed_structure_value(&self) -> ::std::result::Result<&crate::types::RenamedGreeting, &Self> {
         207  +
        /* UnionGenerator.kt:227 */
  119    208   
        if let MyUnion::RenamedStructureValue(val) = &self {
  120    209   
            ::std::result::Result::Ok(val)
  121    210   
        } else {
  122    211   
            ::std::result::Result::Err(self)
  123    212   
        }
         213  +
        /* UnionGenerator.kt:223 */
  124    214   
    }
         215  +
    /* UnionGenerator.kt:121 */
  125    216   
    /// Returns true if this is a [`RenamedStructureValue`](crate::types::MyUnion::RenamedStructureValue).
         217  +
    /* UnionGenerator.kt:122 */
  126    218   
    pub fn is_renamed_structure_value(&self) -> bool {
         219  +
        /* UnionGenerator.kt:123 */
  127    220   
        self.as_renamed_structure_value().is_ok()
         221  +
        /* UnionGenerator.kt:122 */
  128    222   
    }
         223  +
    /* UnionGenerator.kt:217 */
  129    224   
    /// Tries to convert the enum instance into [`StringValue`](crate::types::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
         225  +
    /* UnionGenerator.kt:222 */
  130    226   
    /// Returns `Err(&Self)` if it can't be converted.
         227  +
    /* UnionGenerator.kt:223 */
  131    228   
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
         229  +
        /* UnionGenerator.kt:227 */
  132    230   
        if let MyUnion::StringValue(val) = &self {
  133    231   
            ::std::result::Result::Ok(val)
  134    232   
        } else {
  135    233   
            ::std::result::Result::Err(self)
  136    234   
        }
         235  +
        /* UnionGenerator.kt:223 */
  137    236   
    }
         237  +
    /* UnionGenerator.kt:121 */
  138    238   
    /// Returns true if this is a [`StringValue`](crate::types::MyUnion::StringValue).
         239  +
    /* UnionGenerator.kt:122 */
  139    240   
    pub fn is_string_value(&self) -> bool {
         241  +
        /* UnionGenerator.kt:123 */
  140    242   
        self.as_string_value().is_ok()
         243  +
        /* UnionGenerator.kt:122 */
  141    244   
    }
         245  +
    /* UnionGenerator.kt:217 */
  142    246   
    /// Tries to convert the enum instance into [`StructureValue`](crate::types::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::types::GreetingStruct).
         247  +
    /* UnionGenerator.kt:222 */
  143    248   
    /// Returns `Err(&Self)` if it can't be converted.
         249  +
    /* UnionGenerator.kt:223 */
  144    250   
    pub fn as_structure_value(&self) -> ::std::result::Result<&crate::types::GreetingStruct, &Self> {
         251  +
        /* UnionGenerator.kt:227 */
  145    252   
        if let MyUnion::StructureValue(val) = &self {
  146    253   
            ::std::result::Result::Ok(val)
  147    254   
        } else {
  148    255   
            ::std::result::Result::Err(self)
  149    256   
        }
         257  +
        /* UnionGenerator.kt:223 */
  150    258   
    }
         259  +
    /* UnionGenerator.kt:121 */
  151    260   
    /// Returns true if this is a [`StructureValue`](crate::types::MyUnion::StructureValue).
         261  +
    /* UnionGenerator.kt:122 */
  152    262   
    pub fn is_structure_value(&self) -> bool {
         263  +
        /* UnionGenerator.kt:123 */
  153    264   
        self.as_structure_value().is_ok()
         265  +
        /* UnionGenerator.kt:122 */
  154    266   
    }
         267  +
    /* UnionGenerator.kt:217 */
  155    268   
    /// Tries to convert the enum instance into [`TimestampValue`](crate::types::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_types::DateTime).
         269  +
    /* UnionGenerator.kt:222 */
  156    270   
    /// Returns `Err(&Self)` if it can't be converted.
         271  +
    /* UnionGenerator.kt:223 */
  157    272   
    pub fn as_timestamp_value(&self) -> ::std::result::Result<&::aws_smithy_types::DateTime, &Self> {
         273  +
        /* UnionGenerator.kt:227 */
  158    274   
        if let MyUnion::TimestampValue(val) = &self {
  159    275   
            ::std::result::Result::Ok(val)
  160    276   
        } else {
  161    277   
            ::std::result::Result::Err(self)
  162    278   
        }
         279  +
        /* UnionGenerator.kt:223 */
  163    280   
    }
         281  +
    /* UnionGenerator.kt:121 */
  164    282   
    /// Returns true if this is a [`TimestampValue`](crate::types::MyUnion::TimestampValue).
         283  +
    /* UnionGenerator.kt:122 */
  165    284   
    pub fn is_timestamp_value(&self) -> bool {
         285  +
        /* UnionGenerator.kt:123 */
  166    286   
        self.as_timestamp_value().is_ok()
         287  +
        /* UnionGenerator.kt:122 */
  167    288   
    }
         289  +
    /* UnionGenerator.kt:127 */
  168    290   
    /// Returns true if the enum instance is the `Unknown` variant.
         291  +
    /* UnionGenerator.kt:128 */
  169    292   
    pub fn is_unknown(&self) -> bool {
         293  +
        /* UnionGenerator.kt:129 */
  170    294   
        matches!(self, Self::Unknown)
         295  +
        /* UnionGenerator.kt:128 */
  171    296   
    }
         297  +
    /* UnionGenerator.kt:111 */
  172    298   
}

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

@@ -1,1 +71,129 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct NestedPayload {
           8  +
pub /* StructureGenerator.kt:201 */ struct NestedPayload {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub greeting: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:231 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
    9     14   
    pub name: ::std::option::Option<::std::string::String>,
          15  +
    /* StructureGenerator.kt:201 */
   10     16   
}
          17  +
/* StructureGenerator.kt:135 */
   11     18   
impl NestedPayload {
          19  +
    /* StructureGenerator.kt:231 */
   12     20   
    #[allow(missing_docs)] // documentation missing in model
          21  +
                           /* StructureGenerator.kt:166 */
   13     22   
    pub fn greeting(&self) -> ::std::option::Option<&str> {
          23  +
        /* StructureGenerator.kt:169 */
   14     24   
        self.greeting.as_deref()
          25  +
        /* StructureGenerator.kt:166 */
   15     26   
    }
          27  +
    /* StructureGenerator.kt:231 */
   16     28   
    #[allow(missing_docs)] // documentation missing in model
          29  +
                           /* StructureGenerator.kt:166 */
   17     30   
    pub fn name(&self) -> ::std::option::Option<&str> {
          31  +
        /* StructureGenerator.kt:169 */
   18     32   
        self.name.as_deref()
          33  +
        /* StructureGenerator.kt:166 */
   19     34   
    }
          35  +
    /* StructureGenerator.kt:135 */
   20     36   
}
          37  +
/* ClientCodegenVisitor.kt:237 */
   21     38   
impl NestedPayload {
   22         -
    /// Creates a new builder-style object to manufacture [`NestedPayload`](crate::types::NestedPayload).
          39  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`NestedPayload`](crate::types::NestedPayload).
          40  +
    /* BuilderGenerator.kt:175 */
   23     41   
    pub fn builder() -> crate::types::builders::NestedPayloadBuilder {
          42  +
        /* BuilderGenerator.kt:176 */
   24     43   
        crate::types::builders::NestedPayloadBuilder::default()
          44  +
        /* BuilderGenerator.kt:175 */
   25     45   
    }
          46  +
    /* ClientCodegenVisitor.kt:237 */
   26     47   
}
   27     48   
   28         -
/// A builder for [`NestedPayload`](crate::types::NestedPayload).
          49  +
/// /* BuilderGenerator.kt:342 */A builder for [`NestedPayload`](crate::types::NestedPayload).
          50  +
/* RustType.kt:516 */
   29     51   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          52  +
/* RustType.kt:516 */
   30     53   
#[non_exhaustive]
          54  +
/* BuilderGenerator.kt:345 */
   31     55   
pub struct NestedPayloadBuilder {
   32         -
    pub(crate) greeting: ::std::option::Option<::std::string::String>,
   33         -
    pub(crate) name: ::std::option::Option<::std::string::String>,
          56  +
    /* BuilderGenerator.kt:275 */ pub(crate) greeting: ::std::option::Option<::std::string::String>,
          57  +
    /* BuilderGenerator.kt:275 */ pub(crate) name: ::std::option::Option<::std::string::String>,
          58  +
    /* BuilderGenerator.kt:345 */
   34     59   
}
          60  +
/* BuilderGenerator.kt:355 */
   35     61   
impl NestedPayloadBuilder {
          62  +
    /* BuilderGenerator.kt:286 */
   36     63   
    #[allow(missing_docs)] // documentation missing in model
          64  +
                           /* BuilderGenerator.kt:291 */
   37     65   
    pub fn greeting(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          66  +
        /* BuilderGenerator.kt:292 */
   38     67   
        self.greeting = ::std::option::Option::Some(input.into());
          68  +
        /* BuilderGenerator.kt:293 */
   39     69   
        self
          70  +
        /* BuilderGenerator.kt:291 */
   40     71   
    }
          72  +
    /* BuilderGenerator.kt:312 */
   41     73   
    #[allow(missing_docs)] // documentation missing in model
          74  +
                           /* BuilderGenerator.kt:314 */
   42     75   
    pub fn set_greeting(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          76  +
        /* BuilderGenerator.kt:315 */
   43     77   
        self.greeting = input;
   44     78   
        self
          79  +
        /* BuilderGenerator.kt:314 */
   45     80   
    }
          81  +
    /* BuilderGenerator.kt:334 */
   46     82   
    #[allow(missing_docs)] // documentation missing in model
          83  +
                           /* BuilderGenerator.kt:336 */
   47     84   
    pub fn get_greeting(&self) -> &::std::option::Option<::std::string::String> {
          85  +
        /* BuilderGenerator.kt:337 */
   48     86   
        &self.greeting
          87  +
        /* BuilderGenerator.kt:336 */
   49     88   
    }
          89  +
    /* BuilderGenerator.kt:286 */
   50     90   
    #[allow(missing_docs)] // documentation missing in model
          91  +
                           /* BuilderGenerator.kt:291 */
   51     92   
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          93  +
        /* BuilderGenerator.kt:292 */
   52     94   
        self.name = ::std::option::Option::Some(input.into());
          95  +
        /* BuilderGenerator.kt:293 */
   53     96   
        self
          97  +
        /* BuilderGenerator.kt:291 */
   54     98   
    }
          99  +
    /* BuilderGenerator.kt:312 */
   55    100   
    #[allow(missing_docs)] // documentation missing in model
         101  +
                           /* BuilderGenerator.kt:314 */
   56    102   
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         103  +
        /* BuilderGenerator.kt:315 */
   57    104   
        self.name = input;
   58    105   
        self
         106  +
        /* BuilderGenerator.kt:314 */
   59    107   
    }
         108  +
    /* BuilderGenerator.kt:334 */
   60    109   
    #[allow(missing_docs)] // documentation missing in model
         110  +
                           /* BuilderGenerator.kt:336 */
   61    111   
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
         112  +
        /* BuilderGenerator.kt:337 */
   62    113   
        &self.name
         114  +
        /* BuilderGenerator.kt:336 */
   63    115   
    }
   64         -
    /// Consumes the builder and constructs a [`NestedPayload`](crate::types::NestedPayload).
         116  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`NestedPayload`](crate::types::NestedPayload).
         117  +
    /* BuilderGenerator.kt:253 */
   65    118   
    pub fn build(self) -> crate::types::NestedPayload {
         119  +
        /* BuilderGenerator.kt:477 */
   66    120   
        crate::types::NestedPayload {
   67         -
            greeting: self.greeting,
         121  +
            /* BuilderGenerator.kt:481 */ greeting: self.greeting,
         122  +
            /* BuilderGenerator.kt:481 */
   68    123   
            name: self.name,
         124  +
            /* BuilderGenerator.kt:477 */
   69    125   
        }
         126  +
        /* BuilderGenerator.kt:253 */
   70    127   
    }
         128  +
    /* BuilderGenerator.kt:355 */
   71    129   
}

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

@@ -1,1 +47,88 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct PayloadConfig {
           8  +
pub /* StructureGenerator.kt:201 */ struct PayloadConfig {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub data: ::std::option::Option<i32>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl PayloadConfig {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn data(&self) -> ::std::option::Option<i32> {
          20  +
        /* StructureGenerator.kt:168 */
   12     21   
        self.data
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl PayloadConfig {
   16         -
    /// Creates a new builder-style object to manufacture [`PayloadConfig`](crate::types::PayloadConfig).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`PayloadConfig`](crate::types::PayloadConfig).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::types::builders::PayloadConfigBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::types::builders::PayloadConfigBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`PayloadConfig`](crate::types::PayloadConfig).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`PayloadConfig`](crate::types::PayloadConfig).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct PayloadConfigBuilder {
   26         -
    pub(crate) data: ::std::option::Option<i32>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) data: ::std::option::Option<i32>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl PayloadConfigBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn data(mut self, input: i32) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.data = ::std::option::Option::Some(input);
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_data(mut self, input: ::std::option::Option<i32>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.data = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_data(&self) -> &::std::option::Option<i32> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.data
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`PayloadConfig`](crate::types::PayloadConfig).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`PayloadConfig`](crate::types::PayloadConfig).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> crate::types::PayloadConfig {
   45         -
        crate::types::PayloadConfig { data: self.data }
          80  +
        /* BuilderGenerator.kt:477 */
          81  +
        crate::types::PayloadConfig {
          82  +
            /* BuilderGenerator.kt:481 */ data: self.data,
          83  +
            /* BuilderGenerator.kt:477 */
   46     84   
        }
          85  +
        /* BuilderGenerator.kt:253 */
          86  +
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

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

@@ -1,1 +37,66 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* UnionGenerator.kt:67 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub enum PlayerAction {
    6         -
    /// Quit the game.
           8  +
pub /* UnionGenerator.kt:85 */ enum PlayerAction {
           9  +
    /// /* UnionGenerator.kt:90 */Quit the game.
          10  +
    /* UnionGenerator.kt:188 */
    7     11   
    Quit,
    8         -
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          12  +
    /// /* UnionGenerator.kt:96 */The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          13  +
    /* UnionGenerator.kt:97 */
    9     14   
    /// An unknown enum variant
          15  +
    /* UnionGenerator.kt:98 */
   10     16   
    ///
          17  +
    /* UnionGenerator.kt:99 */
   11     18   
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          19  +
    /* UnionGenerator.kt:100 */
   12     20   
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          21  +
    /* UnionGenerator.kt:101 */
   13     22   
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          23  +
    /* UnionGenerator.kt:102 */
   14     24   
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          25  +
    /* RustType.kt:516 */
   15     26   
    #[non_exhaustive]
          27  +
    /* UnionGenerator.kt:105 */
   16     28   
    Unknown,
          29  +
    /* UnionGenerator.kt:85 */
   17     30   
}
          31  +
/* UnionGenerator.kt:111 */
   18     32   
impl PlayerAction {
          33  +
    /* RustType.kt:516 */
   19     34   
    #[allow(irrefutable_let_patterns)]
          35  +
    /* UnionGenerator.kt:203 */
   20     36   
    /// Tries to convert the enum instance into [`Quit`](crate::types::PlayerAction::Quit), extracting the inner `()`.
          37  +
    /* UnionGenerator.kt:207 */
   21     38   
    /// Returns `Err(&Self)` if it can't be converted.
          39  +
    /* UnionGenerator.kt:208 */
   22     40   
    pub fn as_quit(&self) -> ::std::result::Result<(), &Self> {
          41  +
        /* UnionGenerator.kt:209 */
   23     42   
        if let PlayerAction::Quit = &self {
   24     43   
            ::std::result::Result::Ok(())
   25     44   
        } else {
   26     45   
            ::std::result::Result::Err(self)
   27     46   
        }
          47  +
        /* UnionGenerator.kt:208 */
   28     48   
    }
          49  +
    /* UnionGenerator.kt:121 */
   29     50   
    /// Returns true if this is a [`Quit`](crate::types::PlayerAction::Quit).
          51  +
    /* UnionGenerator.kt:122 */
   30     52   
    pub fn is_quit(&self) -> bool {
          53  +
        /* UnionGenerator.kt:123 */
   31     54   
        self.as_quit().is_ok()
          55  +
        /* UnionGenerator.kt:122 */
   32     56   
    }
          57  +
    /* UnionGenerator.kt:127 */
   33     58   
    /// Returns true if the enum instance is the `Unknown` variant.
          59  +
    /* UnionGenerator.kt:128 */
   34     60   
    pub fn is_unknown(&self) -> bool {
          61  +
        /* UnionGenerator.kt:129 */
   35     62   
        matches!(self, Self::Unknown)
          63  +
        /* UnionGenerator.kt:128 */
   36     64   
    }
          65  +
    /* UnionGenerator.kt:111 */
   37     66   
}

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

@@ -1,1 +71,130 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct RecursiveShapesInputOutputNested1 {
           8  +
pub /* StructureGenerator.kt:201 */ struct RecursiveShapesInputOutputNested1 {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub foo: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:231 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
    9     14   
    pub nested: ::std::option::Option<::std::boxed::Box<crate::types::RecursiveShapesInputOutputNested2>>,
          15  +
    /* StructureGenerator.kt:201 */
   10     16   
}
          17  +
/* StructureGenerator.kt:135 */
   11     18   
impl RecursiveShapesInputOutputNested1 {
          19  +
    /* StructureGenerator.kt:231 */
   12     20   
    #[allow(missing_docs)] // documentation missing in model
          21  +
                           /* StructureGenerator.kt:166 */
   13     22   
    pub fn foo(&self) -> ::std::option::Option<&str> {
          23  +
        /* StructureGenerator.kt:169 */
   14     24   
        self.foo.as_deref()
          25  +
        /* StructureGenerator.kt:166 */
   15     26   
    }
          27  +
    /* StructureGenerator.kt:231 */
   16     28   
    #[allow(missing_docs)] // documentation missing in model
          29  +
                           /* StructureGenerator.kt:166 */
   17     30   
    pub fn nested(&self) -> ::std::option::Option<&crate::types::RecursiveShapesInputOutputNested2> {
          31  +
        /* StructureGenerator.kt:169 */
   18     32   
        self.nested.as_deref()
          33  +
        /* StructureGenerator.kt:166 */
   19     34   
    }
          35  +
    /* StructureGenerator.kt:135 */
   20     36   
}
          37  +
/* ClientCodegenVisitor.kt:237 */
   21     38   
impl RecursiveShapesInputOutputNested1 {
   22         -
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
          39  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
          40  +
    /* BuilderGenerator.kt:175 */
   23     41   
    pub fn builder() -> crate::types::builders::RecursiveShapesInputOutputNested1Builder {
          42  +
        /* BuilderGenerator.kt:176 */
   24     43   
        crate::types::builders::RecursiveShapesInputOutputNested1Builder::default()
          44  +
        /* BuilderGenerator.kt:175 */
   25     45   
    }
          46  +
    /* ClientCodegenVisitor.kt:237 */
   26     47   
}
   27     48   
   28         -
/// A builder for [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
          49  +
/// /* BuilderGenerator.kt:342 */A builder for [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
          50  +
/* RustType.kt:516 */
   29     51   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          52  +
/* RustType.kt:516 */
   30     53   
#[non_exhaustive]
          54  +
/* BuilderGenerator.kt:345 */
   31     55   
pub struct RecursiveShapesInputOutputNested1Builder {
   32         -
    pub(crate) foo: ::std::option::Option<::std::string::String>,
          56  +
    /* BuilderGenerator.kt:275 */ pub(crate) foo: ::std::option::Option<::std::string::String>,
          57  +
    /* BuilderGenerator.kt:275 */
   33     58   
    pub(crate) nested: ::std::option::Option<::std::boxed::Box<crate::types::RecursiveShapesInputOutputNested2>>,
          59  +
    /* BuilderGenerator.kt:345 */
   34     60   
}
          61  +
/* BuilderGenerator.kt:355 */
   35     62   
impl RecursiveShapesInputOutputNested1Builder {
          63  +
    /* BuilderGenerator.kt:286 */
   36     64   
    #[allow(missing_docs)] // documentation missing in model
          65  +
                           /* BuilderGenerator.kt:291 */
   37     66   
    pub fn foo(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          67  +
        /* BuilderGenerator.kt:292 */
   38     68   
        self.foo = ::std::option::Option::Some(input.into());
          69  +
        /* BuilderGenerator.kt:293 */
   39     70   
        self
          71  +
        /* BuilderGenerator.kt:291 */
   40     72   
    }
          73  +
    /* BuilderGenerator.kt:312 */
   41     74   
    #[allow(missing_docs)] // documentation missing in model
          75  +
                           /* BuilderGenerator.kt:314 */
   42     76   
    pub fn set_foo(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          77  +
        /* BuilderGenerator.kt:315 */
   43     78   
        self.foo = input;
   44     79   
        self
          80  +
        /* BuilderGenerator.kt:314 */
   45     81   
    }
          82  +
    /* BuilderGenerator.kt:334 */
   46     83   
    #[allow(missing_docs)] // documentation missing in model
          84  +
                           /* BuilderGenerator.kt:336 */
   47     85   
    pub fn get_foo(&self) -> &::std::option::Option<::std::string::String> {
          86  +
        /* BuilderGenerator.kt:337 */
   48     87   
        &self.foo
          88  +
        /* BuilderGenerator.kt:336 */
   49     89   
    }
          90  +
    /* BuilderGenerator.kt:286 */
   50     91   
    #[allow(missing_docs)] // documentation missing in model
          92  +
                           /* BuilderGenerator.kt:291 */
   51     93   
    pub fn nested(mut self, input: impl ::std::convert::Into<::std::boxed::Box<crate::types::RecursiveShapesInputOutputNested2>>) -> Self {
          94  +
        /* BuilderGenerator.kt:292 */
   52     95   
        self.nested = ::std::option::Option::Some(input.into());
          96  +
        /* BuilderGenerator.kt:293 */
   53     97   
        self
          98  +
        /* BuilderGenerator.kt:291 */
   54     99   
    }
         100  +
    /* BuilderGenerator.kt:312 */
   55    101   
    #[allow(missing_docs)] // documentation missing in model
         102  +
                           /* BuilderGenerator.kt:314 */
   56    103   
    pub fn set_nested(mut self, input: ::std::option::Option<::std::boxed::Box<crate::types::RecursiveShapesInputOutputNested2>>) -> Self {
         104  +
        /* BuilderGenerator.kt:315 */
   57    105   
        self.nested = input;
   58    106   
        self
         107  +
        /* BuilderGenerator.kt:314 */
   59    108   
    }
         109  +
    /* BuilderGenerator.kt:334 */
   60    110   
    #[allow(missing_docs)] // documentation missing in model
         111  +
                           /* BuilderGenerator.kt:336 */
   61    112   
    pub fn get_nested(&self) -> &::std::option::Option<::std::boxed::Box<crate::types::RecursiveShapesInputOutputNested2>> {
         113  +
        /* BuilderGenerator.kt:337 */
   62    114   
        &self.nested
         115  +
        /* BuilderGenerator.kt:336 */
   63    116   
    }
   64         -
    /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
         117  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`RecursiveShapesInputOutputNested1`](crate::types::RecursiveShapesInputOutputNested1).
         118  +
    /* BuilderGenerator.kt:253 */
   65    119   
    pub fn build(self) -> crate::types::RecursiveShapesInputOutputNested1 {
         120  +
        /* BuilderGenerator.kt:477 */
   66    121   
        crate::types::RecursiveShapesInputOutputNested1 {
   67         -
            foo: self.foo,
         122  +
            /* BuilderGenerator.kt:481 */ foo: self.foo,
         123  +
            /* BuilderGenerator.kt:481 */
   68    124   
            nested: self.nested,
         125  +
            /* BuilderGenerator.kt:477 */
   69    126   
        }
         127  +
        /* BuilderGenerator.kt:253 */
   70    128   
    }
         129  +
    /* BuilderGenerator.kt:355 */
   71    130   
}

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

@@ -1,1 +71,130 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct RecursiveShapesInputOutputNested2 {
           8  +
pub /* StructureGenerator.kt:201 */ struct RecursiveShapesInputOutputNested2 {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub bar: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:231 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
    9     14   
    pub recursive_member: ::std::option::Option<crate::types::RecursiveShapesInputOutputNested1>,
          15  +
    /* StructureGenerator.kt:201 */
   10     16   
}
          17  +
/* StructureGenerator.kt:135 */
   11     18   
impl RecursiveShapesInputOutputNested2 {
          19  +
    /* StructureGenerator.kt:231 */
   12     20   
    #[allow(missing_docs)] // documentation missing in model
          21  +
                           /* StructureGenerator.kt:166 */
   13     22   
    pub fn bar(&self) -> ::std::option::Option<&str> {
          23  +
        /* StructureGenerator.kt:169 */
   14     24   
        self.bar.as_deref()
          25  +
        /* StructureGenerator.kt:166 */
   15     26   
    }
          27  +
    /* StructureGenerator.kt:231 */
   16     28   
    #[allow(missing_docs)] // documentation missing in model
          29  +
                           /* StructureGenerator.kt:166 */
   17     30   
    pub fn recursive_member(&self) -> ::std::option::Option<&crate::types::RecursiveShapesInputOutputNested1> {
          31  +
        /* StructureGenerator.kt:170 */
   18     32   
        self.recursive_member.as_ref()
          33  +
        /* StructureGenerator.kt:166 */
   19     34   
    }
          35  +
    /* StructureGenerator.kt:135 */
   20     36   
}
          37  +
/* ClientCodegenVisitor.kt:237 */
   21     38   
impl RecursiveShapesInputOutputNested2 {
   22         -
    /// Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
          39  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
          40  +
    /* BuilderGenerator.kt:175 */
   23     41   
    pub fn builder() -> crate::types::builders::RecursiveShapesInputOutputNested2Builder {
          42  +
        /* BuilderGenerator.kt:176 */
   24     43   
        crate::types::builders::RecursiveShapesInputOutputNested2Builder::default()
          44  +
        /* BuilderGenerator.kt:175 */
   25     45   
    }
          46  +
    /* ClientCodegenVisitor.kt:237 */
   26     47   
}
   27     48   
   28         -
/// A builder for [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
          49  +
/// /* BuilderGenerator.kt:342 */A builder for [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
          50  +
/* RustType.kt:516 */
   29     51   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          52  +
/* RustType.kt:516 */
   30     53   
#[non_exhaustive]
          54  +
/* BuilderGenerator.kt:345 */
   31     55   
pub struct RecursiveShapesInputOutputNested2Builder {
   32         -
    pub(crate) bar: ::std::option::Option<::std::string::String>,
          56  +
    /* BuilderGenerator.kt:275 */ pub(crate) bar: ::std::option::Option<::std::string::String>,
          57  +
    /* BuilderGenerator.kt:275 */
   33     58   
    pub(crate) recursive_member: ::std::option::Option<crate::types::RecursiveShapesInputOutputNested1>,
          59  +
    /* BuilderGenerator.kt:345 */
   34     60   
}
          61  +
/* BuilderGenerator.kt:355 */
   35     62   
impl RecursiveShapesInputOutputNested2Builder {
          63  +
    /* BuilderGenerator.kt:286 */
   36     64   
    #[allow(missing_docs)] // documentation missing in model
          65  +
                           /* BuilderGenerator.kt:291 */
   37     66   
    pub fn bar(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          67  +
        /* BuilderGenerator.kt:292 */
   38     68   
        self.bar = ::std::option::Option::Some(input.into());
          69  +
        /* BuilderGenerator.kt:293 */
   39     70   
        self
          71  +
        /* BuilderGenerator.kt:291 */
   40     72   
    }
          73  +
    /* BuilderGenerator.kt:312 */
   41     74   
    #[allow(missing_docs)] // documentation missing in model
          75  +
                           /* BuilderGenerator.kt:314 */
   42     76   
    pub fn set_bar(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          77  +
        /* BuilderGenerator.kt:315 */
   43     78   
        self.bar = input;
   44     79   
        self
          80  +
        /* BuilderGenerator.kt:314 */
   45     81   
    }
          82  +
    /* BuilderGenerator.kt:334 */
   46     83   
    #[allow(missing_docs)] // documentation missing in model
          84  +
                           /* BuilderGenerator.kt:336 */
   47     85   
    pub fn get_bar(&self) -> &::std::option::Option<::std::string::String> {
          86  +
        /* BuilderGenerator.kt:337 */
   48     87   
        &self.bar
          88  +
        /* BuilderGenerator.kt:336 */
   49     89   
    }
          90  +
    /* BuilderGenerator.kt:286 */
   50     91   
    #[allow(missing_docs)] // documentation missing in model
          92  +
                           /* BuilderGenerator.kt:291 */
   51     93   
    pub fn recursive_member(mut self, input: crate::types::RecursiveShapesInputOutputNested1) -> Self {
          94  +
        /* BuilderGenerator.kt:292 */
   52     95   
        self.recursive_member = ::std::option::Option::Some(input);
          96  +
        /* BuilderGenerator.kt:293 */
   53     97   
        self
          98  +
        /* BuilderGenerator.kt:291 */
   54     99   
    }
         100  +
    /* BuilderGenerator.kt:312 */
   55    101   
    #[allow(missing_docs)] // documentation missing in model
         102  +
                           /* BuilderGenerator.kt:314 */
   56    103   
    pub fn set_recursive_member(mut self, input: ::std::option::Option<crate::types::RecursiveShapesInputOutputNested1>) -> Self {
         104  +
        /* BuilderGenerator.kt:315 */
   57    105   
        self.recursive_member = input;
   58    106   
        self
         107  +
        /* BuilderGenerator.kt:314 */
   59    108   
    }
         109  +
    /* BuilderGenerator.kt:334 */
   60    110   
    #[allow(missing_docs)] // documentation missing in model
         111  +
                           /* BuilderGenerator.kt:336 */
   61    112   
    pub fn get_recursive_member(&self) -> &::std::option::Option<crate::types::RecursiveShapesInputOutputNested1> {
         113  +
        /* BuilderGenerator.kt:337 */
   62    114   
        &self.recursive_member
         115  +
        /* BuilderGenerator.kt:336 */
   63    116   
    }
   64         -
    /// Consumes the builder and constructs a [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
         117  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`RecursiveShapesInputOutputNested2`](crate::types::RecursiveShapesInputOutputNested2).
         118  +
    /* BuilderGenerator.kt:253 */
   65    119   
    pub fn build(self) -> crate::types::RecursiveShapesInputOutputNested2 {
         120  +
        /* BuilderGenerator.kt:477 */
   66    121   
        crate::types::RecursiveShapesInputOutputNested2 {
   67         -
            bar: self.bar,
         122  +
            /* BuilderGenerator.kt:481 */ bar: self.bar,
         123  +
            /* BuilderGenerator.kt:481 */
   68    124   
            recursive_member: self.recursive_member,
         125  +
            /* BuilderGenerator.kt:477 */
   69    126   
        }
         127  +
        /* BuilderGenerator.kt:253 */
   70    128   
    }
         129  +
    /* BuilderGenerator.kt:355 */
   71    130   
}

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

@@ -1,1 +47,88 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct RenamedGreeting {
           8  +
pub /* StructureGenerator.kt:201 */ struct RenamedGreeting {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub salutation: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl RenamedGreeting {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn salutation(&self) -> ::std::option::Option<&str> {
          20  +
        /* StructureGenerator.kt:169 */
   12     21   
        self.salutation.as_deref()
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl RenamedGreeting {
   16         -
    /// Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::types::RenamedGreeting).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`RenamedGreeting`](crate::types::RenamedGreeting).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::types::builders::RenamedGreetingBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::types::builders::RenamedGreetingBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`RenamedGreeting`](crate::types::RenamedGreeting).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`RenamedGreeting`](crate::types::RenamedGreeting).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct RenamedGreetingBuilder {
   26         -
    pub(crate) salutation: ::std::option::Option<::std::string::String>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) salutation: ::std::option::Option<::std::string::String>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl RenamedGreetingBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn salutation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.salutation = ::std::option::Option::Some(input.into());
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_salutation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.salutation = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_salutation(&self) -> &::std::option::Option<::std::string::String> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.salutation
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`RenamedGreeting`](crate::types::RenamedGreeting).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`RenamedGreeting`](crate::types::RenamedGreeting).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> crate::types::RenamedGreeting {
   45         -
        crate::types::RenamedGreeting { salutation: self.salutation }
          80  +
        /* BuilderGenerator.kt:477 */
          81  +
        crate::types::RenamedGreeting {
          82  +
            /* BuilderGenerator.kt:481 */ salutation: self.salutation,
          83  +
            /* BuilderGenerator.kt:477 */
   46     84   
        }
          85  +
        /* BuilderGenerator.kt:253 */
          86  +
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

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

@@ -1,1 +51,90 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* UnionGenerator.kt:67 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub enum SimpleUnion {
    6         -
    #[allow(missing_docs)] // documentation missing in model
           8  +
pub /* UnionGenerator.kt:85 */ enum SimpleUnion {
           9  +
    /* UnionGenerator.kt:90 */ #[allow(missing_docs)] // documentation missing in model
          10  +
    /* UnionGenerator.kt:190 */
    7     11   
    Int(i32),
          12  +
    /* UnionGenerator.kt:90 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
          14  +
    /* UnionGenerator.kt:190 */
    9     15   
    String(::std::string::String),
   10         -
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          16  +
    /// /* UnionGenerator.kt:96 */The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
          17  +
    /* UnionGenerator.kt:97 */
   11     18   
    /// An unknown enum variant
          19  +
    /* UnionGenerator.kt:98 */
   12     20   
    ///
          21  +
    /* UnionGenerator.kt:99 */
   13     22   
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
          23  +
    /* UnionGenerator.kt:100 */
   14     24   
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
          25  +
    /* UnionGenerator.kt:101 */
   15     26   
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
          27  +
    /* UnionGenerator.kt:102 */
   16     28   
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
          29  +
    /* RustType.kt:516 */
   17     30   
    #[non_exhaustive]
          31  +
    /* UnionGenerator.kt:105 */
   18     32   
    Unknown,
          33  +
    /* UnionGenerator.kt:85 */
   19     34   
}
          35  +
/* UnionGenerator.kt:111 */
   20     36   
impl SimpleUnion {
          37  +
    /* UnionGenerator.kt:217 */
   21     38   
    /// Tries to convert the enum instance into [`Int`](crate::types::SimpleUnion::Int), extracting the inner [`i32`](i32).
          39  +
    /* UnionGenerator.kt:222 */
   22     40   
    /// Returns `Err(&Self)` if it can't be converted.
          41  +
    /* UnionGenerator.kt:223 */
   23     42   
    pub fn as_int(&self) -> ::std::result::Result<&i32, &Self> {
          43  +
        /* UnionGenerator.kt:227 */
   24     44   
        if let SimpleUnion::Int(val) = &self {
   25     45   
            ::std::result::Result::Ok(val)
   26     46   
        } else {
   27     47   
            ::std::result::Result::Err(self)
   28     48   
        }
          49  +
        /* UnionGenerator.kt:223 */
   29     50   
    }
          51  +
    /* UnionGenerator.kt:121 */
   30     52   
    /// Returns true if this is a [`Int`](crate::types::SimpleUnion::Int).
          53  +
    /* UnionGenerator.kt:122 */
   31     54   
    pub fn is_int(&self) -> bool {
          55  +
        /* UnionGenerator.kt:123 */
   32     56   
        self.as_int().is_ok()
          57  +
        /* UnionGenerator.kt:122 */
   33     58   
    }
          59  +
    /* UnionGenerator.kt:217 */
   34     60   
    /// Tries to convert the enum instance into [`String`](crate::types::SimpleUnion::String), extracting the inner [`String`](::std::string::String).
          61  +
    /* UnionGenerator.kt:222 */
   35     62   
    /// Returns `Err(&Self)` if it can't be converted.
          63  +
    /* UnionGenerator.kt:223 */
   36     64   
    pub fn as_string(&self) -> ::std::result::Result<&::std::string::String, &Self> {
          65  +
        /* UnionGenerator.kt:227 */
   37     66   
        if let SimpleUnion::String(val) = &self {
   38     67   
            ::std::result::Result::Ok(val)
   39     68   
        } else {
   40     69   
            ::std::result::Result::Err(self)
   41     70   
        }
          71  +
        /* UnionGenerator.kt:223 */
   42     72   
    }
          73  +
    /* UnionGenerator.kt:121 */
   43     74   
    /// Returns true if this is a [`String`](crate::types::SimpleUnion::String).
          75  +
    /* UnionGenerator.kt:122 */
   44     76   
    pub fn is_string(&self) -> bool {
          77  +
        /* UnionGenerator.kt:123 */
   45     78   
        self.as_string().is_ok()
          79  +
        /* UnionGenerator.kt:122 */
   46     80   
    }
          81  +
    /* UnionGenerator.kt:127 */
   47     82   
    /// Returns true if the enum instance is the `Unknown` variant.
          83  +
    /* UnionGenerator.kt:128 */
   48     84   
    pub fn is_unknown(&self) -> bool {
          85  +
        /* UnionGenerator.kt:129 */
   49     86   
        matches!(self, Self::Unknown)
          87  +
        /* UnionGenerator.kt:128 */
   50     88   
    }
          89  +
    /* UnionGenerator.kt:111 */
   51     90   
}

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

@@ -1,1 +102,120 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `StringEnum`, it is important to ensure
           2  +
/* ClientEnumGenerator.kt:234 */
           3  +
/// /* ClientEnumGenerator.kt:234 */When writing a match expression against `StringEnum`, it is important to ensure
    4      4   
/// your code is forward-compatible. That is, if a match arm handles a case for a
    5      5   
/// feature that is supported by the service but has not been represented as an enum
    6      6   
/// variant in a current version of SDK, your code should continue to work when you
    7      7   
/// upgrade SDK to a future version in which the enum does include a variant for that
    8      8   
/// feature.
    9         -
///
   10         -
/// Here is an example of how you can make a match expression forward-compatible:
   11         -
///
   12         -
/// ```text
           9  +
/// /* ClientEnumGenerator.kt:244 */
          10  +
/// /* ClientEnumGenerator.kt:245 */Here is an example of how you can make a match expression forward-compatible:
          11  +
/// /* ClientEnumGenerator.kt:246 */
          12  +
/// /* ClientEnumGenerator.kt:247 */```text
          13  +
/* ClientEnumGenerator.kt:248 */
   13     14   
/// # let stringenum = unimplemented!();
          15  +
/* ClientEnumGenerator.kt:249 */
   14     16   
/// match stringenum {
          17  +
/* ClientEnumGenerator.kt:251 */
   15     18   
///     StringEnum::V => { /* ... */ },
          19  +
/* ClientEnumGenerator.kt:253 */
   16     20   
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          21  +
/* ClientEnumGenerator.kt:254 */
   17     22   
///     _ => { /* ... */ },
          23  +
/* ClientEnumGenerator.kt:255 */
   18     24   
/// }
   19         -
/// ```
   20         -
/// The above code demonstrates that when `stringenum` represents
          25  +
/// /* ClientEnumGenerator.kt:256 */```
          26  +
/// /* ClientEnumGenerator.kt:257 */The above code demonstrates that when `stringenum` represents
   21     27   
/// `NewFeature`, the execution path will lead to the second last match arm,
   22     28   
/// even though the enum does not contain a variant `StringEnum::NewFeature`
   23     29   
/// in the current version of SDK. The reason is that the variable `other`,
   24     30   
/// created by the `@` operator, is bound to
   25     31   
/// `StringEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
   26     32   
/// and calling `as_str` on it yields `"NewFeature"`.
   27     33   
/// This match expression is forward-compatible when executed with a newer
   28     34   
/// version of SDK where the variant `StringEnum::NewFeature` is defined.
   29     35   
/// Specifically, when `stringenum` represents `NewFeature`,
   30     36   
/// the execution path will hit the second last match arm as before by virtue of
   31     37   
/// calling `as_str` on `StringEnum::NewFeature` also yielding `"NewFeature"`.
   32         -
///
   33         -
/// Explicitly matching on the `Unknown` variant should
          38  +
/// /* ClientEnumGenerator.kt:273 */
          39  +
/// /* ClientEnumGenerator.kt:274 */Explicitly matching on the `Unknown` variant should
   34     40   
/// be avoided for two reasons:
   35     41   
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
   36     42   
/// - It might inadvertently shadow other intended match arms.
   37         -
///
          43  +
/// /* ClientEnumGenerator.kt:282 */
          44  +
/* EnumGenerator.kt:154 */
   38     45   
#[allow(missing_docs)] // documentation missing in model
          46  +
/* RustType.kt:516 */
   39     47   
#[non_exhaustive]
          48  +
/* RustType.kt:516 */
   40     49   
#[derive(
   41     50   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
   42     51   
)]
   43         -
pub enum StringEnum {
   44         -
    #[allow(missing_docs)] // documentation missing in model
          52  +
pub /* EnumGenerator.kt:267 */ enum StringEnum {
          53  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          54  +
    /* EnumGenerator.kt:143 */
   45     55   
    V,
   46         -
    /// `Unknown` contains new variants that have been added since this code was generated.
          56  +
    /// /* ClientEnumGenerator.kt:175 */`Unknown` contains new variants that have been added since this code was generated.
          57  +
    /* ClientEnumGenerator.kt:176 */
   47     58   
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
   48         -
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          59  +
    /* ClientEnumGenerator.kt:179 */
          60  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue), /* EnumGenerator.kt:267 */
   49     61   
}
          62  +
/* ClientEnumGenerator.kt:42 */
   50     63   
impl ::std::convert::From<&str> for StringEnum {
   51     64   
    fn from(s: &str) -> Self {
   52     65   
        match s {
   53     66   
            "enumvalue" => StringEnum::V,
   54     67   
            other => StringEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   55     68   
        }
   56     69   
    }
   57     70   
}
          71  +
/* ClientEnumGenerator.kt:68 */
   58     72   
impl ::std::str::FromStr for StringEnum {
   59     73   
    type Err = ::std::convert::Infallible;
   60     74   
   61     75   
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
   62     76   
        ::std::result::Result::Ok(StringEnum::from(s))
   63     77   
    }
   64     78   
}
          79  +
/* EnumGenerator.kt:274 */
   65     80   
impl StringEnum {
   66     81   
    /// Returns the `&str` value of the enum member.
   67     82   
    pub fn as_str(&self) -> &str {
   68     83   
        match self {
   69     84   
            StringEnum::V => "enumvalue",
   70     85   
            StringEnum::Unknown(value) => value.as_str(),
   71     86   
        }
   72     87   
    }
   73     88   
    /// Returns all the `&str` representations of the enum members.
   74     89   
    pub const fn values() -> &'static [&'static str] {
   75     90   
        &["enumvalue"]
   76     91   
    }
   77     92   
}
          93  +
/* EnumGenerator.kt:223 */
   78     94   
impl ::std::convert::AsRef<str> for StringEnum {
   79     95   
    fn as_ref(&self) -> &str {
   80     96   
        self.as_str()
   81     97   
    }
   82     98   
}
          99  +
/* ClientEnumGenerator.kt:117 */
   83    100   
impl StringEnum {
   84    101   
    /// Parses the enum value while disallowing unknown variants.
   85    102   
    ///
   86    103   
    /// Unknown variants will result in an error.
   87    104   
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
   88    105   
        match Self::from(value) {
   89    106   
            #[allow(deprecated)]
   90    107   
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
   91    108   
            known => Ok(known),
   92    109   
        }
   93    110   
    }
   94    111   
}
         112  +
/* ClientEnumGenerator.kt:136 */
   95    113   
impl ::std::fmt::Display for StringEnum {
   96    114   
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
   97    115   
        match self {
   98    116   
            StringEnum::V => write!(f, "enumvalue"),
   99    117   
            StringEnum::Unknown(value) => write!(f, "{}", value),
  100    118   
        }
  101    119   
    }
  102    120   
}

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

@@ -1,1 +68,129 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct StructureListMember {
           8  +
pub /* StructureGenerator.kt:201 */ struct StructureListMember {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub a: ::std::option::Option<::std::string::String>,
          12  +
    /* StructureGenerator.kt:231 */
    8     13   
    #[allow(missing_docs)] // documentation missing in model
    9     14   
    pub b: ::std::option::Option<::std::string::String>,
          15  +
    /* StructureGenerator.kt:201 */
   10     16   
}
          17  +
/* StructureGenerator.kt:135 */
   11     18   
impl StructureListMember {
          19  +
    /* StructureGenerator.kt:231 */
   12     20   
    #[allow(missing_docs)] // documentation missing in model
          21  +
                           /* StructureGenerator.kt:166 */
   13     22   
    pub fn a(&self) -> ::std::option::Option<&str> {
          23  +
        /* StructureGenerator.kt:169 */
   14     24   
        self.a.as_deref()
          25  +
        /* StructureGenerator.kt:166 */
   15     26   
    }
          27  +
    /* StructureGenerator.kt:231 */
   16     28   
    #[allow(missing_docs)] // documentation missing in model
          29  +
                           /* StructureGenerator.kt:166 */
   17     30   
    pub fn b(&self) -> ::std::option::Option<&str> {
          31  +
        /* StructureGenerator.kt:169 */
   18     32   
        self.b.as_deref()
          33  +
        /* StructureGenerator.kt:166 */
   19     34   
    }
          35  +
    /* StructureGenerator.kt:135 */
   20     36   
}
          37  +
/* ClientCodegenVisitor.kt:237 */
   21     38   
impl StructureListMember {
   22         -
    /// Creates a new builder-style object to manufacture [`StructureListMember`](crate::types::StructureListMember).
          39  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`StructureListMember`](crate::types::StructureListMember).
          40  +
    /* BuilderGenerator.kt:175 */
   23     41   
    pub fn builder() -> crate::types::builders::StructureListMemberBuilder {
          42  +
        /* BuilderGenerator.kt:176 */
   24     43   
        crate::types::builders::StructureListMemberBuilder::default()
          44  +
        /* BuilderGenerator.kt:175 */
   25     45   
    }
          46  +
    /* ClientCodegenVisitor.kt:237 */
   26     47   
}
   27     48   
   28         -
/// A builder for [`StructureListMember`](crate::types::StructureListMember).
          49  +
/// /* BuilderGenerator.kt:342 */A builder for [`StructureListMember`](crate::types::StructureListMember).
          50  +
/* RustType.kt:516 */
   29     51   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          52  +
/* RustType.kt:516 */
   30     53   
#[non_exhaustive]
          54  +
/* BuilderGenerator.kt:345 */
   31     55   
pub struct StructureListMemberBuilder {
   32         -
    pub(crate) a: ::std::option::Option<::std::string::String>,
   33         -
    pub(crate) b: ::std::option::Option<::std::string::String>,
          56  +
    /* BuilderGenerator.kt:275 */ pub(crate) a: ::std::option::Option<::std::string::String>,
          57  +
    /* BuilderGenerator.kt:275 */ pub(crate) b: ::std::option::Option<::std::string::String>,
          58  +
    /* BuilderGenerator.kt:345 */
   34     59   
}
          60  +
/* BuilderGenerator.kt:355 */
   35     61   
impl StructureListMemberBuilder {
          62  +
    /* BuilderGenerator.kt:286 */
   36     63   
    #[allow(missing_docs)] // documentation missing in model
          64  +
                           /* BuilderGenerator.kt:291 */
   37     65   
    pub fn a(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          66  +
        /* BuilderGenerator.kt:292 */
   38     67   
        self.a = ::std::option::Option::Some(input.into());
          68  +
        /* BuilderGenerator.kt:293 */
   39     69   
        self
          70  +
        /* BuilderGenerator.kt:291 */
   40     71   
    }
          72  +
    /* BuilderGenerator.kt:312 */
   41     73   
    #[allow(missing_docs)] // documentation missing in model
          74  +
                           /* BuilderGenerator.kt:314 */
   42     75   
    pub fn set_a(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
          76  +
        /* BuilderGenerator.kt:315 */
   43     77   
        self.a = input;
   44     78   
        self
          79  +
        /* BuilderGenerator.kt:314 */
   45     80   
    }
          81  +
    /* BuilderGenerator.kt:334 */
   46     82   
    #[allow(missing_docs)] // documentation missing in model
          83  +
                           /* BuilderGenerator.kt:336 */
   47     84   
    pub fn get_a(&self) -> &::std::option::Option<::std::string::String> {
          85  +
        /* BuilderGenerator.kt:337 */
   48     86   
        &self.a
          87  +
        /* BuilderGenerator.kt:336 */
   49     88   
    }
          89  +
    /* BuilderGenerator.kt:286 */
   50     90   
    #[allow(missing_docs)] // documentation missing in model
          91  +
                           /* BuilderGenerator.kt:291 */
   51     92   
    pub fn b(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
          93  +
        /* BuilderGenerator.kt:292 */
   52     94   
        self.b = ::std::option::Option::Some(input.into());
          95  +
        /* BuilderGenerator.kt:293 */
   53     96   
        self
          97  +
        /* BuilderGenerator.kt:291 */
   54     98   
    }
          99  +
    /* BuilderGenerator.kt:312 */
   55    100   
    #[allow(missing_docs)] // documentation missing in model
         101  +
                           /* BuilderGenerator.kt:314 */
   56    102   
    pub fn set_b(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
         103  +
        /* BuilderGenerator.kt:315 */
   57    104   
        self.b = input;
   58    105   
        self
         106  +
        /* BuilderGenerator.kt:314 */
   59    107   
    }
         108  +
    /* BuilderGenerator.kt:334 */
   60    109   
    #[allow(missing_docs)] // documentation missing in model
         110  +
                           /* BuilderGenerator.kt:336 */
   61    111   
    pub fn get_b(&self) -> &::std::option::Option<::std::string::String> {
         112  +
        /* BuilderGenerator.kt:337 */
   62    113   
        &self.b
         114  +
        /* BuilderGenerator.kt:336 */
   63    115   
    }
   64         -
    /// Consumes the builder and constructs a [`StructureListMember`](crate::types::StructureListMember).
         116  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`StructureListMember`](crate::types::StructureListMember).
         117  +
    /* BuilderGenerator.kt:253 */
   65    118   
    pub fn build(self) -> crate::types::StructureListMember {
   66         -
        crate::types::StructureListMember { a: self.a, b: self.b }
         119  +
        /* BuilderGenerator.kt:477 */
         120  +
        crate::types::StructureListMember {
         121  +
            /* BuilderGenerator.kt:481 */ a: self.a,
         122  +
            /* BuilderGenerator.kt:481 */
         123  +
            b: self.b,
         124  +
            /* BuilderGenerator.kt:477 */
   67    125   
        }
         126  +
        /* BuilderGenerator.kt:253 */
         127  +
    }
         128  +
    /* BuilderGenerator.kt:355 */
   68    129   
}

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

@@ -1,1 +47,88 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* StructureGenerator.kt:197 */
    2      3   
#[allow(missing_docs)] // documentation missing in model
           4  +
/* RustType.kt:516 */
    3      5   
#[non_exhaustive]
           6  +
/* RustType.kt:516 */
    4      7   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
    5         -
pub struct TestConfig {
           8  +
pub /* StructureGenerator.kt:201 */ struct TestConfig {
           9  +
    /* StructureGenerator.kt:231 */
    6     10   
    #[allow(missing_docs)] // documentation missing in model
    7     11   
    pub timeout: ::std::option::Option<i32>,
          12  +
    /* StructureGenerator.kt:201 */
    8     13   
}
          14  +
/* StructureGenerator.kt:135 */
    9     15   
impl TestConfig {
          16  +
    /* StructureGenerator.kt:231 */
   10     17   
    #[allow(missing_docs)] // documentation missing in model
          18  +
                           /* StructureGenerator.kt:166 */
   11     19   
    pub fn timeout(&self) -> ::std::option::Option<i32> {
          20  +
        /* StructureGenerator.kt:168 */
   12     21   
        self.timeout
          22  +
        /* StructureGenerator.kt:166 */
   13     23   
    }
          24  +
    /* StructureGenerator.kt:135 */
   14     25   
}
          26  +
/* ClientCodegenVisitor.kt:237 */
   15     27   
impl TestConfig {
   16         -
    /// Creates a new builder-style object to manufacture [`TestConfig`](crate::types::TestConfig).
          28  +
    /// /* BuilderGenerator.kt:173 */Creates a new builder-style object to manufacture [`TestConfig`](crate::types::TestConfig).
          29  +
    /* BuilderGenerator.kt:175 */
   17     30   
    pub fn builder() -> crate::types::builders::TestConfigBuilder {
          31  +
        /* BuilderGenerator.kt:176 */
   18     32   
        crate::types::builders::TestConfigBuilder::default()
          33  +
        /* BuilderGenerator.kt:175 */
   19     34   
    }
          35  +
    /* ClientCodegenVisitor.kt:237 */
   20     36   
}
   21     37   
   22         -
/// A builder for [`TestConfig`](crate::types::TestConfig).
          38  +
/// /* BuilderGenerator.kt:342 */A builder for [`TestConfig`](crate::types::TestConfig).
          39  +
/* RustType.kt:516 */
   23     40   
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
          41  +
/* RustType.kt:516 */
   24     42   
#[non_exhaustive]
          43  +
/* BuilderGenerator.kt:345 */
   25     44   
pub struct TestConfigBuilder {
   26         -
    pub(crate) timeout: ::std::option::Option<i32>,
          45  +
    /* BuilderGenerator.kt:275 */ pub(crate) timeout: ::std::option::Option<i32>,
          46  +
    /* BuilderGenerator.kt:345 */
   27     47   
}
          48  +
/* BuilderGenerator.kt:355 */
   28     49   
impl TestConfigBuilder {
          50  +
    /* BuilderGenerator.kt:286 */
   29     51   
    #[allow(missing_docs)] // documentation missing in model
          52  +
                           /* BuilderGenerator.kt:291 */
   30     53   
    pub fn timeout(mut self, input: i32) -> Self {
          54  +
        /* BuilderGenerator.kt:292 */
   31     55   
        self.timeout = ::std::option::Option::Some(input);
          56  +
        /* BuilderGenerator.kt:293 */
   32     57   
        self
          58  +
        /* BuilderGenerator.kt:291 */
   33     59   
    }
          60  +
    /* BuilderGenerator.kt:312 */
   34     61   
    #[allow(missing_docs)] // documentation missing in model
          62  +
                           /* BuilderGenerator.kt:314 */
   35     63   
    pub fn set_timeout(mut self, input: ::std::option::Option<i32>) -> Self {
          64  +
        /* BuilderGenerator.kt:315 */
   36     65   
        self.timeout = input;
   37     66   
        self
          67  +
        /* BuilderGenerator.kt:314 */
   38     68   
    }
          69  +
    /* BuilderGenerator.kt:334 */
   39     70   
    #[allow(missing_docs)] // documentation missing in model
          71  +
                           /* BuilderGenerator.kt:336 */
   40     72   
    pub fn get_timeout(&self) -> &::std::option::Option<i32> {
          73  +
        /* BuilderGenerator.kt:337 */
   41     74   
        &self.timeout
          75  +
        /* BuilderGenerator.kt:336 */
   42     76   
    }
   43         -
    /// Consumes the builder and constructs a [`TestConfig`](crate::types::TestConfig).
          77  +
    /// /* BuilderGenerator.kt:240 */Consumes the builder and constructs a [`TestConfig`](crate::types::TestConfig).
          78  +
    /* BuilderGenerator.kt:253 */
   44     79   
    pub fn build(self) -> crate::types::TestConfig {
   45         -
        crate::types::TestConfig { timeout: self.timeout }
          80  +
        /* BuilderGenerator.kt:477 */
          81  +
        crate::types::TestConfig {
          82  +
            /* BuilderGenerator.kt:481 */ timeout: self.timeout,
          83  +
            /* BuilderGenerator.kt:477 */
   46     84   
        }
          85  +
        /* BuilderGenerator.kt:253 */
          86  +
    }
          87  +
    /* BuilderGenerator.kt:355 */
   47     88   
}

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

@@ -1,1 +114,136 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
    3         -
/// When writing a match expression against `TestEnum`, it is important to ensure
           2  +
/* ClientEnumGenerator.kt:234 */
           3  +
/// /* ClientEnumGenerator.kt:234 */When writing a match expression against `TestEnum`, it is important to ensure
    4      4   
/// your code is forward-compatible. That is, if a match arm handles a case for a
    5      5   
/// feature that is supported by the service but has not been represented as an enum
    6      6   
/// variant in a current version of SDK, your code should continue to work when you
    7      7   
/// upgrade SDK to a future version in which the enum does include a variant for that
    8      8   
/// feature.
    9         -
///
   10         -
/// Here is an example of how you can make a match expression forward-compatible:
   11         -
///
   12         -
/// ```text
           9  +
/// /* ClientEnumGenerator.kt:244 */
          10  +
/// /* ClientEnumGenerator.kt:245 */Here is an example of how you can make a match expression forward-compatible:
          11  +
/// /* ClientEnumGenerator.kt:246 */
          12  +
/// /* ClientEnumGenerator.kt:247 */```text
          13  +
/* ClientEnumGenerator.kt:248 */
   13     14   
/// # let testenum = unimplemented!();
          15  +
/* ClientEnumGenerator.kt:249 */
   14     16   
/// match testenum {
          17  +
/* ClientEnumGenerator.kt:251 */
   15     18   
///     TestEnum::Bar => { /* ... */ },
          19  +
/* ClientEnumGenerator.kt:251 */
   16     20   
///     TestEnum::Baz => { /* ... */ },
          21  +
/* ClientEnumGenerator.kt:251 */
   17     22   
///     TestEnum::Foo => { /* ... */ },
          23  +
/* ClientEnumGenerator.kt:253 */
   18     24   
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
          25  +
/* ClientEnumGenerator.kt:254 */
   19     26   
///     _ => { /* ... */ },
          27  +
/* ClientEnumGenerator.kt:255 */
   20     28   
/// }
   21         -
/// ```
   22         -
/// The above code demonstrates that when `testenum` represents
          29  +
/// /* ClientEnumGenerator.kt:256 */```
          30  +
/// /* ClientEnumGenerator.kt:257 */The above code demonstrates that when `testenum` represents
   23     31   
/// `NewFeature`, the execution path will lead to the second last match arm,
   24     32   
/// even though the enum does not contain a variant `TestEnum::NewFeature`
   25     33   
/// in the current version of SDK. The reason is that the variable `other`,
   26     34   
/// created by the `@` operator, is bound to
   27     35   
/// `TestEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
   28     36   
/// and calling `as_str` on it yields `"NewFeature"`.
   29     37   
/// This match expression is forward-compatible when executed with a newer
   30     38   
/// version of SDK where the variant `TestEnum::NewFeature` is defined.
   31     39   
/// Specifically, when `testenum` represents `NewFeature`,
   32     40   
/// the execution path will hit the second last match arm as before by virtue of
   33     41   
/// calling `as_str` on `TestEnum::NewFeature` also yielding `"NewFeature"`.
   34         -
///
   35         -
/// Explicitly matching on the `Unknown` variant should
          42  +
/// /* ClientEnumGenerator.kt:273 */
          43  +
/// /* ClientEnumGenerator.kt:274 */Explicitly matching on the `Unknown` variant should
   36     44   
/// be avoided for two reasons:
   37     45   
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
   38     46   
/// - It might inadvertently shadow other intended match arms.
   39         -
///
          47  +
/// /* ClientEnumGenerator.kt:282 */
          48  +
/* EnumGenerator.kt:154 */
   40     49   
#[allow(missing_docs)] // documentation missing in model
          50  +
/* RustType.kt:516 */
   41     51   
#[non_exhaustive]
          52  +
/* RustType.kt:516 */
   42     53   
#[derive(
   43     54   
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
   44     55   
)]
   45         -
pub enum TestEnum {
   46         -
    #[allow(missing_docs)] // documentation missing in model
          56  +
pub /* EnumGenerator.kt:267 */ enum TestEnum {
          57  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          58  +
    /* EnumGenerator.kt:143 */
   47     59   
    Bar,
   48         -
    #[allow(missing_docs)] // documentation missing in model
          60  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          61  +
    /* EnumGenerator.kt:143 */
   49     62   
    Baz,
   50         -
    #[allow(missing_docs)] // documentation missing in model
          63  +
    /* EnumGenerator.kt:154 */ #[allow(missing_docs)] // documentation missing in model
          64  +
    /* EnumGenerator.kt:143 */
   51     65   
    Foo,
   52         -
    /// `Unknown` contains new variants that have been added since this code was generated.
          66  +
    /// /* ClientEnumGenerator.kt:175 */`Unknown` contains new variants that have been added since this code was generated.
          67  +
    /* ClientEnumGenerator.kt:176 */
   53     68   
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
   54         -
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
          69  +
    /* ClientEnumGenerator.kt:179 */
          70  +
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue), /* EnumGenerator.kt:267 */
   55     71   
}
          72  +
/* ClientEnumGenerator.kt:42 */
   56     73   
impl ::std::convert::From<&str> for TestEnum {
   57     74   
    fn from(s: &str) -> Self {
   58     75   
        match s {
   59     76   
            "BAR" => TestEnum::Bar,
   60     77   
            "BAZ" => TestEnum::Baz,
   61     78   
            "FOO" => TestEnum::Foo,
   62     79   
            other => TestEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
   63     80   
        }
   64     81   
    }
   65     82   
}
          83  +
/* ClientEnumGenerator.kt:68 */
   66     84   
impl ::std::str::FromStr for TestEnum {
   67     85   
    type Err = ::std::convert::Infallible;
   68     86   
   69     87   
    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
   70     88   
        ::std::result::Result::Ok(TestEnum::from(s))
   71     89   
    }
   72     90   
}
          91  +
/* EnumGenerator.kt:274 */
   73     92   
impl TestEnum {
   74     93   
    /// Returns the `&str` value of the enum member.
   75     94   
    pub fn as_str(&self) -> &str {
   76     95   
        match self {
   77     96   
            TestEnum::Bar => "BAR",
   78     97   
            TestEnum::Baz => "BAZ",
   79     98   
            TestEnum::Foo => "FOO",
   80     99   
            TestEnum::Unknown(value) => value.as_str(),
   81    100   
        }
   82    101   
    }
   83    102   
    /// Returns all the `&str` representations of the enum members.
   84    103   
    pub const fn values() -> &'static [&'static str] {
   85    104   
        &["BAR", "BAZ", "FOO"]
   86    105   
    }
   87    106   
}
         107  +
/* EnumGenerator.kt:223 */
   88    108   
impl ::std::convert::AsRef<str> for TestEnum {
   89    109   
    fn as_ref(&self) -> &str {
   90    110   
        self.as_str()
   91    111   
    }
   92    112   
}
         113  +
/* ClientEnumGenerator.kt:117 */
   93    114   
impl TestEnum {
   94    115   
    /// Parses the enum value while disallowing unknown variants.
   95    116   
    ///
   96    117   
    /// Unknown variants will result in an error.
   97    118   
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
   98    119   
        match Self::from(value) {
   99    120   
            #[allow(deprecated)]
  100    121   
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
  101    122   
            known => Ok(known),
  102    123   
        }
  103    124   
    }
  104    125   
}
         126  +
/* ClientEnumGenerator.kt:136 */
  105    127   
impl ::std::fmt::Display for TestEnum {
  106    128   
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
  107    129   
        match self {
  108    130   
            TestEnum::Bar => write!(f, "BAR"),
  109    131   
            TestEnum::Baz => write!(f, "BAZ"),
  110    132   
            TestEnum::Foo => write!(f, "FOO"),
  111    133   
            TestEnum::Unknown(value) => write!(f, "{}", value),
  112    134   
        }
  113    135   
    }
  114    136   
}