]> saetta.ns0.it Git - rust/zakgrid/commitdiff
Impl Display for Align.
authorAndrea Zagli <azagli@libero.it>
Sat, 1 Jun 2024 09:04:05 +0000 (11:04 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 1 Jun 2024 09:04:05 +0000 (11:04 +0200)
src/lib.rs

index df3c19167f6c02adecd2a26ec03cb6b3edcd66f0..a1425969a6a3a807a4d4ca8f40c27d7a4733fc04 100644 (file)
@@ -1,4 +1,4 @@
-use std::any::Any;
+use std::{fmt, any::Any};
 
 use serde_derive::Serialize;
 use tera::Tera;
@@ -12,6 +12,16 @@ pub enum Align {
        Right,
 }
 
+impl fmt::Display for Align {
+       fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+               write!(f, "{}", match self {
+                       Align::Left => "left",
+                       Align::Center => "center",
+                       Align::Right => "right",
+               })
+       }
+}
+
 pub struct Column {
        name: String,
        title: String,