use std::fmt; use std::fmt::Formatter; trait Format { fn rename(f: &mut fmt::Formatter<'_>, from: &str, to: &str) -> fmt::Result; fn unreadable(f: &mut fmt::Formatter<'_>, path: &str) -> fmt::Result; fn unknown_type(f: &mut fmt::Formatter<'_>, path: &str) -> fmt::Result; } struct Script {} impl Format for Script { fn rename(f: &mut Formatter<'_>, from: &str, to: &str) -> fmt::Result { write!(f, "mv {} {}", from, to) } fn unreadable(f: &mut Formatter<'_>, path: &str) -> fmt::Result { write!(f, "# Failed to read {}", path) } fn unknown_type(f: &mut Formatter<'_>, path: &str) -> fmt::Result { write!(f, "# Failed to detect mime type for {}", path) } }