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