toasty_sql/stmt/
name.rs

1use std::fmt;
2
3#[derive(Debug, Clone)]
4pub struct Name(pub Vec<String>);
5
6impl From<&str> for Name {
7    fn from(value: &str) -> Self {
8        Self(vec![value.into()])
9    }
10}
11
12impl From<&String> for Name {
13    fn from(value: &String) -> Self {
14        Self::from(&value[..])
15    }
16}
17
18impl fmt::Display for Name {
19    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20        let mut s = "";
21        for ident in &self.0 {
22            write!(f, "{s}{ident}")?;
23            s = ", ";
24        }
25
26        Ok(())
27    }
28}