pub trait FileSystem: FileSystemRawwhere
    Self::Error: From<Self::AccessError>,{
    type Error: Error + From<Self::AccessError>;

Show 15 methods // Required methods fn open<P: AsRef<Path>, Opts: OpenOptions>( &self, path: P, options: Opts ) -> Result<File, Self::Error>; fn close(&self, file: File) -> Result<(), Self::Error>; fn tell(&self, file: &mut File) -> Result<c_uint, Self::Error>; fn seek_raw( &self, file: &mut File, pos: c_int, whence: Whence ) -> Result<c_uint, Self::Error>; fn read( &self, file: &mut File, to: &mut Vec<u8>, len: c_uint ) -> Result<c_uint, Self::Error>; fn write(&self, file: &mut File, from: &[u8]) -> Result<c_uint, Self::Error>; fn flush(&self, file: &mut File) -> Result<c_uint, Self::Error>; fn metadata<P: AsRef<Path>>(&self, path: P) -> Result<FileStat, Self::Error>; fn metadata_to<P: AsRef<Path>>( &self, path: P, metadata: &mut FileStat ) -> Result<(), Self::Error>; fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>; fn remove<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>; fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>; fn rename<P: AsRef<Path>, Q: AsRef<Path>>( &self, from: P, to: Q ) -> Result<(), Self::Error>; fn read_dir<P, Fn>( &self, path: P, callback: Fn, include_hidden: bool ) -> Result<(), Self::Error> where P: AsRef<Path>, Fn: FnMut(String); // Provided method fn seek( &self, file: &mut File, pos: SeekFrom ) -> Result<c_uint, Self::Error> { ... }
}

Required Associated Types§

source

type Error: Error + From<Self::AccessError>

Required Methods§

source

fn open<P: AsRef<Path>, Opts: OpenOptions>( &self, path: P, options: Opts ) -> Result<File, Self::Error>

Open file for given options.

source

fn close(&self, file: File) -> Result<(), Self::Error>

Close the file.

source

fn tell(&self, file: &mut File) -> Result<c_uint, Self::Error>

Get current cursor position in the file, in bytes.

source

fn seek_raw( &self, file: &mut File, pos: c_int, whence: Whence ) -> Result<c_uint, Self::Error>

Seek to an offset, in bytes.

Works similarly to [std::io::Seek::seek].

source

fn read( &self, file: &mut File, to: &mut Vec<u8>, len: c_uint ) -> Result<c_uint, Self::Error>

Read the len bytes of a file into the to vector.

Works similarly to [std::io::Read::read].

source

fn write(&self, file: &mut File, from: &[u8]) -> Result<c_uint, Self::Error>

Write a buffer into the file, returning how many bytes were written.

Works similarly to [std::io::Write::write].

source

fn flush(&self, file: &mut File) -> Result<c_uint, Self::Error>

Flush the file, ensuring that all intermediately buffered contents reach their destination.

Works similarly to [std::io::Write::flush].

source

fn metadata<P: AsRef<Path>>(&self, path: P) -> Result<FileStat, Self::Error>

source

fn metadata_to<P: AsRef<Path>>( &self, path: P, metadata: &mut FileStat ) -> Result<(), Self::Error>

source

fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>

source

fn remove<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>

source

fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<(), Self::Error>

source

fn rename<P: AsRef<Path>, Q: AsRef<Path>>( &self, from: P, to: Q ) -> Result<(), Self::Error>

source

fn read_dir<P, Fn>( &self, path: P, callback: Fn, include_hidden: bool ) -> Result<(), Self::Error>where P: AsRef<Path>, Fn: FnMut(String),

Provided Methods§

source

fn seek(&self, file: &mut File, pos: SeekFrom) -> Result<c_uint, Self::Error>

Sets the read/write offset in the given file handle to the pos, in bytes.

Works similarly to [std::io::Seek::seek].

Implementors§

source§

impl<T, E> FileSystem for Twhere T: FileSystemRaw<AccessError = E>, ApiError: From<E>,