cli_table/display.rs
1use std::fmt;
2
3/// A table which implements the `Display` trait
4pub struct TableDisplay {
5 inner: String,
6}
7
8impl TableDisplay {
9 pub(crate) fn new(inner: Vec<u8>) -> Self {
10 TableDisplay {
11 inner: String::from_utf8(inner).expect("valid utf8 string"),
12 }
13 }
14}
15
16impl fmt::Display for TableDisplay {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 write!(f, "{}", self.inner.trim())
19 }
20}