Struct io_providers::TempFs [−][src]
pub struct TempFs { /* fields omitted */ }
Provides access to file I/O in a chroot-like temporary filesystem, located in the system's default temp directory. This temporary directory acts like the root of the filesystem: all absolute paths are relative to it, and any path which would traverse out of it is considered invalid.
Details to be aware of:
- This is NOT intended to act as a secure sandbox; while it ought to handle edge cases such as path traversals and symbolic links correctly, no attempt has been made to verify that there is no way to circumvent this.
Fs::create_dir_all()
is not currently implemented. It is possible to implement, but it's non-trivial to handle path traversals and symlinks for this function.
Methods
impl TempFs
[src]
impl TempFs
pub fn new() -> Result<TempFs>
[src]
pub fn new() -> Result<TempFs>
Creates a new TempFs
.
pub fn path(&self) -> &Path
[src]
pub fn path(&self) -> &Path
Returns the path to the root of this temporary filesystem.
Trait Implementations
impl Debug for TempFs
[src]
impl Debug for TempFs
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Fs for TempFs
[src]
impl Fs for TempFs
fn open<P: AsRef<Path>>(
&mut self,
path: P,
open_options: &OpenOptions
) -> Result<File>
[src]
fn open<P: AsRef<Path>>(
&mut self,
path: P,
open_options: &OpenOptions
) -> Result<File>
Opens a file at path
with the options specified by open_options
. Read more
fn copy<P: AsRef<Path>, Q: AsRef<Path>>(
&mut self,
from: P,
to: Q
) -> Result<u64>
[src]
fn copy<P: AsRef<Path>, Q: AsRef<Path>>(
&mut 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>>(&mut self, path: P) -> Result<()>
[src]
fn create_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Creates a new, empty directory at the provided path. Read more
fn create_dir_all<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
fn create_dir_all<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Recursively create a directory and all of its parent components if they are missing. Read more
fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(
&mut self,
src: P,
dst: Q
) -> Result<()>
[src]
fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(
&mut 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<Metadata>
[src]
fn metadata<P: AsRef<Path>>(&self, path: P) -> Result<Metadata>
Given a path, query the file system to get information about a file, directory, etc. Read more
fn read<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
[src]
fn read<P: AsRef<Path>>(&self, path: P) -> Result<Vec<u8>>
Read the entire contents of a file into a bytes vector. Read more
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<ReadDir>
[src]
fn read_dir<P: AsRef<Path>>(&self, path: P) -> Result<ReadDir>
Returns an iterator over the entries within a directory. Read more
fn read_link<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf>
[src]
fn read_link<P: AsRef<Path>>(&self, path: P) -> Result<PathBuf>
Reads a symbolic link, returning the file that the link points to. Read more
fn read_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
[src]
fn read_to_string<P: AsRef<Path>>(&self, path: P) -> Result<String>
Read the entire contents of a file into a string. Read more
fn remove_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
fn remove_dir<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Removes an existing, empty directory. Read more
fn remove_dir_all<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
fn remove_dir_all<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Removes a directory at this path, after removing all its contents. Use carefully! Read more
fn remove_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
[src]
fn remove_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Removes a file from the filesystem. Read more
fn rename<P: AsRef<Path>, Q: AsRef<Path>>(
&mut self,
from: P,
to: Q
) -> Result<()>
[src]
fn rename<P: AsRef<Path>, Q: AsRef<Path>>(
&mut self,
from: P,
to: Q
) -> Result<()>
Rename a file or directory to a new name, replacing the original file if to
already exists. Read more
fn set_permissions<P: AsRef<Path>>(
&mut self,
path: P,
perm: Permissions
) -> Result<()>
[src]
fn set_permissions<P: AsRef<Path>>(
&mut self,
path: P,
perm: Permissions
) -> Result<()>
Changes the permissions found on a file or a directory. Read more
fn symlink_metadata<P: AsRef<Path>>(&self, path: P) -> Result<Metadata>
[src]
fn symlink_metadata<P: AsRef<Path>>(&self, path: P) -> Result<Metadata>
Query the metadata about a file without following symlinks. Read more
fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
&mut self,
path: P,
contents: C
) -> Result<()>
[src]
fn write<P: AsRef<Path>, C: AsRef<[u8]>>(
&mut self,
path: P,
contents: C
) -> Result<()>
Write a slice as the entire contents of a file. Read more
fn exists<P: AsRef<Path>>(&self, path: P) -> bool
[src]
fn exists<P: AsRef<Path>>(&self, path: P) -> bool
Returns whether the path points at an existing entity. Read more