Struct rsfs::mem::unix::FS
[−]
[src]
pub struct FS(_);
An in-memory struct that satisfies rsfs::GenFS
.
FS
is thread safe and copyable. It operates internally with an Arc<Mutex<FileSystem>>
(FileSystem
not being exported) and forces all filesystem calls to go through the mutex. FS
attempts to mimic all real errors that could occur on a filesystem. Generally, unless a FS
is
setup with restrictive permissions, errors will only be encountered when operating on
non-existent filesystem entries or performing invalid oprations.
See the module documentation or every struct's documentation for more examples of using an
FS
.
Examples
use rsfs::*; use rsfs::mem::FS; let fs = FS::new();
Methods
impl FS
[src]
Trait Implementations
impl Clone for FS
[src]
fn clone(&self) -> FS
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for FS
[src]
impl Default for FS
[src]
impl GenFS for FS
[src]
type DirBuilder = DirBuilder
The DirBuilder
type in the same module implementing this trait.
type DirEntry = DirEntry
The DirEntry
type in the same module implementing this trait.
type File = File
The File
type in the same module implementing this trait.
type Metadata = Metadata
The Metadata
type in the same module implementing this trait.
type OpenOptions = OpenOptions
The OpenOptions
type in the same module implementing this trait.
type Permissions = Permissions
The Permissions
type in the same module implementing this trait.
type ReadDir = ReadDir
The ReadDir
type in the same module implementing this trait.
fn canonicalize<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf>
Returns the canonical form of a path with all intermediate components normalized and symbolic links resolved. Read more
fn copy<P: AsRef<Path>, Q: AsRef<Path>>(&self, from: P, to: Q) -> Result<u64>
Copies the contents of one file to another. This function will also copy the permission bits of the original file to the destination file. Read more
fn create_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Creates a new, empty directory at the provided path. Read more
fn create_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Recursively creates a directory and all its parent components if they are missing. Read more
fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(
&self,
src: P,
dst: Q
) -> Result<()>
&self,
src: P,
dst: Q
) -> Result<()>
Creates a new hard link on the filesystem. Read more
fn metadata<P: AsRef<Path>>(&self, path: P) -> Result<Self::Metadata>
Returns metadata information of the file or directory at path. Read more
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<Self::ReadDir>
Returns an iterator over entries within a directory. Read more
fn read_link<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf>
Reads a symbolic link, returning the entry the link points to. Read more
fn remove_dir<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes an existing, empty directory. Read more
fn remove_dir_all<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes a directory at path after removing all of its contents. Read more
fn remove_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Removes a file from the filesystem. Read more
fn rename<P: AsRef<Path>, Q: AsRef<Path>>(&self, from: P, to: Q) -> Result<()>
Renames a file or directory at from
to to
, replacing to
if it exists. Read more
fn set_permissions<P: AsRef<Path>>(
&self,
path: P,
perms: Self::Permissions
) -> Result<()>
&self,
path: P,
perms: Self::Permissions
) -> Result<()>
Changes the permissions of a file or directory. Read more
fn symlink_metadata<P: AsRef<Path>>(&self, path: P) -> Result<Self::Metadata>
Query the metadata about a file without following symlinks. Read more
fn new_openopts(&self) -> Self::OpenOptions
Returns a new OpenOptions for a file for this filesytem. Read more
fn new_dirbuilder(&self) -> Self::DirBuilder
Returns a new DirBuilder for a directory for this filesystem. Read more
fn open_file<P: AsRef<Path>>(&self, path: P) -> Result<Self::File>
Opens a file in read-only mode. Read more
fn create_file<P: AsRef<Path>>(&self, path: P) -> Result<Self::File>
Opens a file in write-only mode. Read more