message: Mustache templating: deserialize_enum.mustache
diff: {{#required}}
  +let mut value = {{#toUpper}}{{type}}{{/toUpper}}::_MAX_;
  if reader.is_next_string() {
  - {{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} = get_{{#toLower}}{{type}}{{/toLower}}_value(reader.read_string().unwrap_or_default().as_str())
  + value = get_{{#toLower}}{{type}}{{/toLower}}_value(&reader.read_string().unwrap_or_default())
  .expect("Failed to get {{#toUpper}}{{type}}{{/toUpper}} value");
  } else {
  - {{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} = {{#toUpper}}{{type}}{{/toUpper}}::try_from(reader.read_i32().unwrap_or_default())
  + value = {{#toUpper}}{{type}}{{/toUpper}}::try_from(reader.read_i32().unwrap_or_default())
  .expect("Failed to convert i32 to {{#toUpper}}{{type}}{{/toUpper}}");
  - sanitize_{{#toLower}}{{type}}{{/toLower}}_value({{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} as i32)
  + sanitize_{{#toLower}}{{type}}{{/toLower}}_value(value as i32)
  .expect("Failed to sanitize {{#toUpper}}{{type}}{{/toUpper}}");
  }
  +en = value;
  +en_set = true;
  {{/required}}
  {{^required}}
  +let mut value: Option<{{#toUpper}}{{type}}{{/toUpper}}> = None;
  if !reader.is_next_nil() {
  if reader.is_next_string() {
  - {{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} = Some(
  - get_{{#toLower}}{{type}}{{/toLower}}_value(
  - reader.read_string().unwrap_or_default().as_str(),
  - )
  - .expect("Failed to get {{#toWasm}}{{toGraphQLType}}{{/toWasm}} value"),
  - );
  + value = Some(get_{{#toLower}}{{type}}{{/toLower}}_value(&reader.read_string().unwrap_or_default())
  + .expect("Failed to get Option<{{#toUpper}}{{type}}{{/toUpper}}> value"));
  } else {
  - {{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} = Some(
  - {{#toUpper}}{{type}}{{/toUpper}}::try_from(reader.read_i32().unwrap_or_default())
  - .expect("Failed to convert i32 to {{#toWasm}}{{toGraphQLType}}{{/toWasm}}"),
  - );
  - sanitize_{{#toLower}}{{type}}{{/toLower}}_value({{#toLower}}{{name}}{{/toLower}}.unwrap() as i32)
  - .expect("Failed to sanitize {{#toWasm}}{{toGraphQLType}}{{/toWasm}}");
  + value = Some({{#toUpper}}{{type}}{{/toUpper}}::try_from(reader.read_i32().unwrap_or_default())
  + .expect("Failed to convert i32 to Option<{{#toUpper}}{{type}}{{/toUpper}}>"));
  + sanitize_{{#toLower}}{{type}}{{/toLower}}_value(value.unwrap() as i32)
  + .expect("Failed to sanitize Option<{{#toUpper}}{{type}}{{/toUpper}}>");
  }
  } else {
  - {{#toRustProp}}{{#toLower}}{{name}}{{/toLower}}{{/toRustProp}} = None;
  + value = None;
  }
  +opt_enum = value;
  {{/required}}
  \ No newline at end of file
  