1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use super::{escape::escape, guid::to_guid}; use crate::{Unix, UnixType}; use std::fmt::{Display, Formatter, Result as FmtResult}; impl Display for Unix { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "unix:")?; self.r#type.fmt(f)?; if let Some(guid) = &self.guid { write!(f, ",guid={}", to_guid(guid)) } else { Ok(()) } } } impl Display for UnixType { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { match self { UnixType::Path(path) => write!(f, "path={}", escape(path)), UnixType::Dir(dir) => write!(f, "dir={}", escape(dir)), UnixType::Tmpdir(tmp_dir) => write!(f, "tmpdir={}", escape(tmp_dir)), UnixType::Abstract(abstract_) => write!(f, "abstract={}", escape(abstract_)), UnixType::Runtime => write!(f, "runtime=yes"), } } }