pub struct Fs;Trait Implementations§
Source§impl Fs for Fs
impl Fs for Fs
Source§type FileLock = FileLock
type FileLock = FileLock
Type used to hold an exclusive lock on a file open. The lock should be released when the
FileLock is dropped.Source§type TempFile = TempFile
type TempFile = TempFile
The type returned by the
Self::temp_file method. Some implementations may make this
type Drop so that the temporary file can be cleaned up when it is closed.Source§type TempDir = TempDir
type TempDir = TempDir
The type returned by the
Self::temp_dir method. Some implementations may make this
type Drop so that the temporary directory can be cleaned up when it is closed.Source§fn metadata(&self, path: &Path) -> Result<Option<Metadata>>
fn metadata(&self, path: &Path) -> Result<Option<Metadata>>
Get the metadata of the file at
path. If path doesn’t exist, return Ok(None). If the
last component is a symlink, return the metadata about the symlink instead of trying to
resolve it. An error may be returned if there is an error attempting to resolve path.
For example, if path contains a dangling symlink, or if an intermediate component of the
path is a file.Source§fn read_file(&self, path: &Path, contents: &mut [u8]) -> Result<usize>
fn read_file(&self, path: &Path, contents: &mut [u8]) -> Result<usize>
Read the first bytes of the file at
path. If path resolves to a symlink, it will be
resolved, recursively, until a file is found or an error occurs. The number of bytes
actually read is returned. If this equals the size of the slice passed it, it’s
undetermined whether there are more bytes available in the file.Source§fn read_dir(
&self,
path: &Path,
) -> Result<impl Iterator<Item = Result<(OsString, Metadata)>>>
fn read_dir( &self, path: &Path, ) -> Result<impl Iterator<Item = Result<(OsString, Metadata)>>>
Return and iterator that will yield all of the children of a directory, excluding “.” and
“..”. There must be a directory at
path, or an error will be returned. If path resolves
to a symlink, it will be resolved, recursively, until a directory is found or an error
occurs.Source§fn create_file(&self, path: &Path, contents: &[u8]) -> Result<()>
fn create_file(&self, path: &Path, contents: &[u8]) -> Result<()>
Create a file with given
path and contents. There must not be any file or directory at
path, but its parent directory must be exist.Source§fn possibly_create_file_and_try_exclusive_lock(
&self,
path: &Path,
) -> Result<Option<FileLock>>
fn possibly_create_file_and_try_exclusive_lock( &self, path: &Path, ) -> Result<Option<FileLock>>
Try to obtain an exclusive lock on
path. If path doesn’t exist, this method will try to
first create an empty file at path. If a file exists at path and can be opened, or if
new a file can be created at path, then this method will return Ok. Then, if an
exclusive file lock can be obtained, Ok(Some) will be returned, otherwise Ok(None). If
an other error is encountered, then Err will be returned.Source§fn symlink(&self, target: &Path, link: &Path) -> Result<()>
fn symlink(&self, target: &Path, link: &Path) -> Result<()>
Create a symlink at
link that points to target. There must not be any file or directory
at link, but its parent directory must exist.Source§fn mkdir(&self, path: &Path) -> Result<()>
fn mkdir(&self, path: &Path) -> Result<()>
Create an empty directory at
path. There must not be any file or directory at path, but
its parent directory must exist.Source§fn mkdir_recursively(&self, path: &Path) -> Result<()>
fn mkdir_recursively(&self, path: &Path) -> Result<()>
Attempt to create a directory at
path by creating any missing ancestor directories. Don’t
error if there is already a directory at path.Source§fn remove(&self, path: &Path) -> Result<()>
fn remove(&self, path: &Path) -> Result<()>
Remove an existing, non-directory entry at
path. If path resolves to a symlink, the
symlink will be removed, not the target of the symlink.Source§fn rmdir_recursively_on_thread(&self, path: PathBuf) -> Result<()>
fn rmdir_recursively_on_thread(&self, path: PathBuf) -> Result<()>
Remove an existing directory, and all of its descendants, on a background thread.
path
must exist, and it must be a directory. This function will return an error immediately if
path doesn’t exist, can’t be resolved, or doesn’t point to a directory. Otherwise, the
removal will happen in the background on another thread. If an error occurs there, the
calling function won’t be notified.Source§fn rename(&self, source: &Path, destination: &Path) -> Result<()>
fn rename(&self, source: &Path, destination: &Path) -> Result<()>
Rename
source to destination. There are a bunch of rules that must be satisfied for
this to succeed: Read moreSource§fn temp_file(&self, parent: &Path) -> Result<Self::TempFile>
fn temp_file(&self, parent: &Path) -> Result<Self::TempFile>
Create a new temporary file in the directory
parent.Source§fn persist_temp_file(
&self,
temp_file: Self::TempFile,
target: &Path,
) -> Result<()>
fn persist_temp_file( &self, temp_file: Self::TempFile, target: &Path, ) -> Result<()>
Rename
temp_file to target while consuming temp_file. This is different than the
caller just doing the rename itself in that it consumes temp_file without dropping it.Auto Trait Implementations§
impl Freeze for Fs
impl RefUnwindSafe for Fs
impl Send for Fs
impl Sync for Fs
impl Unpin for Fs
impl UnsafeUnpin for Fs
impl UnwindSafe for Fs
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more