Struct filesystem::OsFileSystem
[−]
[src]
pub struct OsFileSystem {}
An implementation of FileSystem
that interacts with the actual operating system's file system.
This is primarily a wrapper for fs
methods.
Methods
impl OsFileSystem
[src]
Trait Implementations
impl Clone for OsFileSystem
[src]
fn clone(&self) -> OsFileSystem
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for OsFileSystem
[src]
impl Default for OsFileSystem
[src]
fn default() -> OsFileSystem
[src]
Returns the "default value" for a type. Read more
impl FileSystem for OsFileSystem
[src]
type DirEntry = DirEntry
type ReadDir = ReadDir
fn current_dir(&self) -> Result<PathBuf>
[src]
Returns the current working directory. This is based on [std::env::current_dir
]. Read more
fn set_current_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Updates the current working directory. This is based on [std::env::set_current_dir
]. Read more
fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Determines whether the path exists and points to a directory.
fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
[src]
Determines whether the path exists and points to a file.
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Creates a new directory. This is based on [std::fs::create_dir
]. Read more
fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Recursively creates a directory and any missing parents. This is based on [std::fs::create_dir
]. Read more
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Removes an empty directory. This is based on [std::fs::remove_dir
]. Read more
fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Removes a directory and any child files or directories. This is based on [std::fs::remove_dir_all
]. Read more
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
[src]
Returns an iterator over the entries in a directory. This is based on [std::fs::read_dir
]. Read more
fn write_file<P, B>(&self, path: P, buf: B) -> Result<()> where
P: AsRef<Path>,
B: AsRef<[u8]>,
[src]
P: AsRef<Path>,
B: AsRef<[u8]>,
Writes buf
to a new or existing file at buf
. This will overwrite any contents that already exist. Read more
fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()> where
P: AsRef<Path>,
B: AsRef<[u8]>,
[src]
P: AsRef<Path>,
B: AsRef<[u8]>,
Writes buf
to an existing file at buf
. This will overwrite any contents that already exist. Read more
fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
[src]
Returns the contents of path
. Read more
fn read_file_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
[src]
Returns the contents of path
as a string. Read more
fn create_file<P, B>(&self, path: P, buf: B) -> Result<()> where
P: AsRef<Path>,
B: AsRef<[u8]>,
[src]
P: AsRef<Path>,
B: AsRef<[u8]>,
Writes buf
to a new file at path
. Read more
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
[src]
Removes the file at path
. This is based on [std::fs::remove_file
]. Read more
fn copy_file<P, Q>(&self, from: P, to: Q) -> Result<()> where
P: AsRef<Path>,
Q: AsRef<Path>,
[src]
P: AsRef<Path>,
Q: AsRef<Path>,
Copies the file at path from
to the path to
. This is based on [std::fs::copy
]. Read more
fn rename<P, Q>(&self, from: P, to: Q) -> Result<()> where
P: AsRef<Path>,
Q: AsRef<Path>,
[src]
P: AsRef<Path>,
Q: AsRef<Path>,
Renames a file or directory. If both from
and to
are files, to
will be replaced. Based on [std::fs::rename
]. Read more
fn readonly<P: AsRef<Path>>(&self, path: P) -> Result<bool>
[src]
Returns true
if path
is a readonly file. Read more
fn set_readonly<P: AsRef<Path>>(&self, path: P, readonly: bool) -> Result<()>
[src]
Sets or unsets the readonly flag of path
. Read more
impl UnixFileSystem for OsFileSystem
[src]
fn mode<P: AsRef<Path>>(&self, path: P) -> Result<u32>
[src]
Returns the current mode bits of path
. Read more
fn set_mode<P: AsRef<Path>>(&self, path: P, mode: u32) -> Result<()>
[src]
Sets the mode bits of path
. Read more