pub struct OsFileSystem {}Expand description
An implementation of FileSystem that interacts with the actual operating system’s file system.
This is primarily a wrapper for fs methods.
Implementations§
Source§impl OsFileSystem
impl OsFileSystem
Trait Implementations§
Source§impl Clone for OsFileSystem
impl Clone for OsFileSystem
Source§fn clone(&self) -> OsFileSystem
fn clone(&self) -> OsFileSystem
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OsFileSystem
impl Debug for OsFileSystem
Source§impl Default for OsFileSystem
impl Default for OsFileSystem
Source§fn default() -> OsFileSystem
fn default() -> OsFileSystem
Returns the “default value” for a type. Read more
Source§impl FileSystem for OsFileSystem
impl FileSystem for OsFileSystem
type DirEntry = DirEntry
type ReadDir = ReadDir
Source§fn current_dir(&self) -> Result<PathBuf>
fn current_dir(&self) -> Result<PathBuf>
Returns the current working directory.
This is based on
std::env::current_dir.Source§fn set_current_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn set_current_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Updates the current working directory.
This is based on
std::env::set_current_dir.Source§fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
fn is_dir<P: AsRef<Path>>(&self, path: P) -> bool
Determines whether the path exists and points to a directory.
Source§fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
fn is_file<P: AsRef<Path>>(&self, path: P) -> bool
Determines whether the path exists and points to a file.
Source§fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Creates a new directory.
This is based on
std::fs::create_dir.Source§fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Recursively creates a directory and any missing parents.
This is based on
std::fs::create_dir.Source§fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes an empty directory.
This is based on
std::fs::remove_dir.Source§fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes a directory and any child files or directories.
This is based on
std::fs::remove_dir_all.Source§fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
Returns an iterator over the entries in a directory.
This is based on
std::fs::read_dir.Source§fn write_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn write_file<P, B>(&self, path: P, buf: B) -> Result<()>
Writes
buf to a new or existing file at buf.
This will overwrite any contents that already exist. Read moreSource§fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn overwrite_file<P, B>(&self, path: P, buf: B) -> Result<()>
Writes
buf to an existing file at buf.
This will overwrite any contents that already exist. Read moreSource§fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
fn read_file<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
Returns the contents of
path. Read moreSource§fn read_file_into<P, B>(&self, path: P, buf: B) -> Result<usize>
fn read_file_into<P, B>(&self, path: P, buf: B) -> Result<usize>
Writes the contents of
path into the buffer. If successful, returns
the number of bytes that were read. Read moreSource§fn read_file_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
fn read_file_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
Returns the contents of
path as a string. Read moreSource§fn create_file<P, B>(&self, path: P, buf: B) -> Result<()>
fn create_file<P, B>(&self, path: P, buf: B) -> Result<()>
Source§fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes the file at
path.
This is based on std::fs::remove_file.Source§fn rename<P, Q>(&self, from: P, to: Q) -> Result<()>
fn rename<P, Q>(&self, from: P, to: Q) -> Result<()>
Renames a file or directory.
If both
from and to are files, to will be replaced.
Based on std::fs::rename.Auto Trait Implementations§
impl Freeze for OsFileSystem
impl RefUnwindSafe for OsFileSystem
impl Send for OsFileSystem
impl Sync for OsFileSystem
impl Unpin for OsFileSystem
impl UnwindSafe for OsFileSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more