]> saetta.ns0.it Git - rust/zakform/commitdiff
Added field::get_name.
authorAndrea Zagli <azagli@libero.it>
Sat, 11 Feb 2023 10:52:52 +0000 (11:52 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 11 Feb 2023 10:52:52 +0000 (11:52 +0100)
src/fields.rs

index c65e839384e59f5b09bbecafd89bff2260cfcf5f..95af99de2c9431d4030aab7f2cbf4c2daf44e687 100644 (file)
@@ -18,6 +18,8 @@ pub trait TField {
        fn new(name: &str) -> Self;
 
        fn render(&self) -> String;
+
+       fn get_name(&self) -> String;
 }
 
 #[derive(Default)]
@@ -45,6 +47,10 @@ _ => {},
                f
        }
 
+       fn get_name(&self) -> String {
+               String::from(&self.field.name)
+       }
+
        fn render(&self) -> String {
                let mut s = String::new();
 
@@ -106,6 +112,10 @@ _ => {},
                f
        }
 
+       fn get_name(&self) -> String {
+               String::from(&self.field.name)
+       }
+
        fn render(&self) -> String {
                let mut s = String::new();