Skip to main content

FileSystemExt

Trait FileSystemExt 

Source
pub trait FileSystemExt {
    // Required methods
    fn read_all(&self, path: &FsPath) -> FsResult<Vec<u8>>;
    fn write_all(&self, path: &FsPath, bytes: &[u8]) -> FsResult<WriteOutcome>;
}
Expand description

Convenience methods for filesystem trait objects.

Required Methods§

Source

fn read_all(&self, path: &FsPath) -> FsResult<Vec<u8>>

Reads an entire resource into memory.

§Parameters
  • path: Resource path.
§Returns

Resource bytes.

§Errors

Returns crate::FsError when opening or reading fails.

Source

fn write_all(&self, path: &FsPath, bytes: &[u8]) -> FsResult<WriteOutcome>

Writes an entire resource and commits the writer.

§Parameters
  • path: Resource path.
  • bytes: Bytes to write.
§Returns

Write outcome.

§Errors

Returns crate::FsError when opening, writing, or committing fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> FileSystemExt for T
where T: FileSystem + ?Sized,