use hyper::StatusCode; use argentum_rest_infrastructure::data_type::http_response::ContentTypeResponseTrait; {{#each responseNames as |name|}} use crate::dto::response::{{upper_camel name}}Response; {{/each}} pub enum {{ upper_camel operation.operationId }}OperationResponseEnum { {{#each responseNames as |name|}} Status{{upper_camel @key}}({{upper_camel name}}Response), {{/each}} } impl {{ upper_camel operation.operationId }}OperationResponseEnum { pub fn to_status_code(&self) -> StatusCode { match self { {{#each responseNames as |name|}} {{#if (eq @key "default") }} Self::Status{{upper_camel @key}}(_) => StatusCode::INTERNAL_SERVER_ERROR, {{else}} Self::Status{{upper_camel @key}}(_) => StatusCode::from_u16({{upper_camel @key}}).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR), {{/if}} {{/each}} } } pub fn to_response(&self) -> Box { match self { {{#each responseNames as |name|}} Self::Status{{upper_camel @key}}(r) => r.to_content_type_response_trait(), {{/each}} } } }