file_operation/file/
impl.rs

1use super::r#type::FileDataString;
2use std::fmt;
3
4impl From<Vec<u8>> for FileDataString {
5    fn from(bytes: Vec<u8>) -> Self {
6        FileDataString(String::from_utf8(bytes).unwrap_or_else(|_| String::new()))
7    }
8}
9
10impl fmt::Display for FileDataString {
11    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
12        write!(f, "{}", self.0)
13    }
14}