fix(rust, client): fix breaking regression introduced by #10432 (#10720)

* Fix breaking regression introduced by #10432

This change forgot enum structures, which causes the compiler to throw errors for "the trait `Default` is not implemented for MyEnum".
This change implements the Default trait to the enum template.

* fix: add Default for type enums
This commit is contained in:
Foorack / Max Faxälv 2021-11-11 07:26:21 +01:00 committed by GitHub
parent c9495dc251
commit 30e1ba7c87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,14 @@ impl ToString for {{{classname}}} {
}
}
}
impl Default for {{{classname}}} {
fn default() -> {{{classname}}} {
{{#allowableValues}}
Self::{{ enumVars.0.name }}
{{/allowableValues}}
}
}
{{/isEnum}}
{{!-- for schemas that have a discriminator --}}
@ -95,6 +103,14 @@ pub enum {{{enumName}}} {
{{/enumVars}}
{{/allowableValues}}
}
impl Default for {{{enumName}}} {
fn default() -> {{{enumName}}} {
{{#allowableValues}}
Self::{{ enumVars.0.name }}
{{/allowableValues}}
}
}
{{/isEnum}}
{{/vars}}