From 5ca669e0c90e2e491f005960c358ff41ab807475 Mon Sep 17 00:00:00 2001 From: Jens Reimann Date: Tue, 1 Mar 2022 11:33:28 +0100 Subject: [PATCH] fix compilation error in rust client when using enums as part of the path --- .../src/main/resources/rust/model.mustache | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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}} }