diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index 1bd2b8db9e09..15f343ae2e47 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -17,12 +17,12 @@ pub enum {{{classname}}} { {{/enumVars}}{{/allowableValues}} } -impl ToString for {{{classname}}} { - fn to_string(&self) -> String { +impl std::fmt::Display for {{{classname}}} { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { {{#allowableValues}} {{#enumVars}} - Self::{{{name}}} => String::from("{{{value}}}"), + Self::{{{name}}} => write!(f, "{{{value}}}"), {{/enumVars}} {{/allowableValues}} }