nutt_web/modules/
displayable.rs

1use std::fmt::{Display, Formatter};
2
3pub(crate) struct DisplayableVec<T>(pub Vec<T>);
4
5impl<T> Display for DisplayableVec<T>
6where
7    T: Display,
8{
9    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
10        let mut out = String::new();
11        for i in 0..self.0.len() - 1 {
12            out.push_str(
13                self.0[i]
14                    .to_string()
15                    .replace("\r", "")
16                    .replace("\n", "")
17                    .as_str(),
18            );
19            out.push_str("; ")
20        }
21        out.push_str(self.0[self.0.len() - 1].to_string().as_str());
22
23        write!(f, "{out}")
24    }
25}