Trait FileSystem

Source
pub trait FileSystem: Send + Sync {
    type File: File;

Show 13 methods // Required methods fn open_file( &self, path: impl AsRef<Utf8Path>, flags: OpenFlags, ) -> Result<Self::File>; fn metadata(&self, path: impl AsRef<Utf8Path>) -> Result<Metadata>; fn rename( &self, from: impl AsRef<Utf8Path>, to: impl AsRef<Utf8Path>, ) -> Result<()>; fn exists(&self, path: impl AsRef<Utf8Path>) -> Result<bool>; fn create_dir(&self, path: impl AsRef<Utf8Path>) -> Result<()>; fn remove_dir(&self, path: impl AsRef<Utf8Path>) -> Result<()>; fn remove_file(&self, path: impl AsRef<Utf8Path>) -> Result<()>; fn read_dir(&self, path: impl AsRef<Utf8Path>) -> Result<Vec<DirEntry>>; // Provided methods fn create_file(&self, path: impl AsRef<Utf8Path>) -> Result<Self::File> { ... } fn remove(&self, path: impl AsRef<Utf8Path>) -> Result<()> { ... } fn read(&self, path: impl AsRef<Utf8Path>) -> Result<Vec<u8>> { ... } fn read_to_string(&self, path: impl AsRef<Utf8Path>) -> Result<String> { ... } fn write( &self, path: impl AsRef<Utf8Path>, data: impl AsRef<[u8]>, ) -> Result<()> { ... }
}

Required Associated Types§

Required Methods§

Source

fn open_file( &self, path: impl AsRef<Utf8Path>, flags: OpenFlags, ) -> Result<Self::File>

Source

fn metadata(&self, path: impl AsRef<Utf8Path>) -> Result<Metadata>

Source

fn rename( &self, from: impl AsRef<Utf8Path>, to: impl AsRef<Utf8Path>, ) -> Result<()>

Source

fn exists(&self, path: impl AsRef<Utf8Path>) -> Result<bool>

Source

fn create_dir(&self, path: impl AsRef<Utf8Path>) -> Result<()>

Source

fn remove_dir(&self, path: impl AsRef<Utf8Path>) -> Result<()>

Source

fn remove_file(&self, path: impl AsRef<Utf8Path>) -> Result<()>

Source

fn read_dir(&self, path: impl AsRef<Utf8Path>) -> Result<Vec<DirEntry>>

Provided Methods§

Source

fn create_file(&self, path: impl AsRef<Utf8Path>) -> Result<Self::File>

Source

fn remove(&self, path: impl AsRef<Utf8Path>) -> Result<()>

Source

fn read(&self, path: impl AsRef<Utf8Path>) -> Result<Vec<u8>>

Corresponds to std::fs::read(). Will open a file at the path and read the entire file into a buffer.

Source

fn read_to_string(&self, path: impl AsRef<Utf8Path>) -> Result<String>

Source

fn write( &self, path: impl AsRef<Utf8Path>, data: impl AsRef<[u8]>, ) -> Result<()>

Corresponds to std::fs::write(). Will open a file at the path, create it if it does not exist (and truncate it) and then write the provided bytes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl FileSystem for luminol_filesystem::project::FileSystem

Source§

impl FileSystem for luminol_filesystem::list::FileSystem

Source§

type File = Box<dyn File>

Source§

impl FileSystem for luminol_filesystem::native::FileSystem

Source§

impl FileSystem for dyn ErasedFilesystem

Source§

type File = Box<dyn File>

Source§

impl<F> FileSystem for luminol_filesystem::path_cache::FileSystem<F>
where F: FileSystemTrait,

Source§

impl<T> FileSystem for luminol_filesystem::archiver::FileSystem<T>
where T: File,

Source§

type File = File<T>