pub trait WorkingCopy {
type Error: Error + Send;
type Writer: Write;
fn create_dir_all(&self, path: &str) -> Result<(), Self::Error>;
fn file_metadata(&self, file: &str) -> Result<InodeMetadata, Self::Error>;
fn read_file(
&self,
file: &str,
buffer: &mut Vec<u8>
) -> Result<(), Self::Error>;
fn modified_time(&self, file: &str) -> Result<SystemTime, Self::Error>;
fn remove_path(&self, name: &str, rec: bool) -> Result<(), Self::Error>;
fn rename(&self, former: &str, new: &str) -> Result<(), Self::Error>;
fn set_permissions(
&self,
name: &str,
permissions: u16
) -> Result<(), Self::Error>;
fn write_file(&self, file: &str) -> Result<Self::Writer, Self::Error>;
fn decode_file(
&self,
file: &str,
buffer: &mut Vec<u8>
) -> Result<Option<Encoding>, Self::Error> { ... }
}
Read the file into the buffer
Returns the file’s text encoding or None if it was a binary file