pub struct RealFs;Expand description
The real file system, unconfined.
Trait Implementations§
impl Copy for RealFs
Source§impl Fs for RealFs
impl Fs for RealFs
Source§fn root(&self) -> Option<&Path>
fn root(&self) -> Option<&Path>
The directory this view is confined to, or
None for the whole file
system. Ancestor walks (such as sync-root detection) stop here.fn exists(&self, path: &Path) -> bool
fn is_dir(&self, path: &Path) -> bool
fn read_to_string(&self, path: &Path) -> Result<String>
Source§fn file_size(&self, path: &Path) -> Result<u64>
fn file_size(&self, path: &Path) -> Result<u64>
The size of a file in bytes. The default reads the file; real file
systems answer from its metadata.
fn write(&self, path: &Path, contents: &[u8]) -> Result<()>
Source§fn write_new(
&self,
path: &Path,
contents: &[u8],
like: Option<&Path>,
) -> Result<()>
fn write_new( &self, path: &Path, contents: &[u8], like: Option<&Path>, ) -> Result<()>
Creates
path, which must not exist, writes contents and flushes
them to disk. With like, the new file gets the permissions of that
existing file: its mode on Unix, its attributes and DACL on Windows.
Used for the temp file of an atomic replace (SPEC 8.4).Source§fn replace(&self, from: &Path, to: &Path) -> Result<()>
fn replace(&self, from: &Path, to: &Path) -> Result<()>
Moves
from over to, replacing it atomically. On Unix the
directory is flushed afterwards.Source§fn write_private(&self, path: &Path, contents: &[u8]) -> Result<()>
fn write_private(&self, path: &Path, contents: &[u8]) -> Result<()>
Writes
contents to path (created or truncated) so that only the
current user can read or write it: mode 0600 on Unix, a protected
DACL granting only the file’s owner on Windows. Flushes to disk.fn create_dir_all(&self, path: &Path) -> Result<()>
Source§fn create_private_dir_all(&self, path: &Path) -> Result<()>
fn create_private_dir_all(&self, path: &Path) -> Result<()>
Creates
path and its missing parents; path itself is restricted
to the current user (mode 0700 on Unix, a protected DACL granting
only the owner, inherited by new children, on Windows).fn remove_file(&self, path: &Path) -> Result<()>
Source§fn is_regular_file(&self, path: &Path) -> bool
fn is_regular_file(&self, path: &Path) -> bool
Whether
path itself is a regular file: links are not followed, so
a symbolic link, a junction or another reparse point is not one.Source§fn overwrite_with_zeros(&self, path: &Path) -> Result<()>
fn overwrite_with_zeros(&self, path: &Path) -> Result<()>
Overwrites every byte of the existing regular file
path with zero,
in place: the file is opened for writing without being created or
truncated, as many zero bytes as it holds are written from offset 0,
and the file is flushed to disk (sync_all). Its length stays the
same. Fails when path is missing or not a regular file.fn remove_dir_all(&self, path: &Path) -> Result<()>
Source§fn read_dir(&self, path: &Path) -> Result<Vec<PathBuf>>
fn read_dir(&self, path: &Path) -> Result<Vec<PathBuf>>
Paths of the entries of a directory, sorted.
Source§fn open_lock_file(&self, path: &Path) -> Result<File>
fn open_lock_file(&self, path: &Path) -> Result<File>
Opens
path for use as an advisory lock file, creating it if needed.
The contents are never read or written.Source§fn canonicalize(&self, path: &Path) -> Result<PathBuf>
fn canonicalize(&self, path: &Path) -> Result<PathBuf>
path with symlinks and junctions resolved (std::fs::canonicalize;
on Windows a \\?\ path). Views that cannot resolve links return
path as it is.Source§fn write_probe(&self) -> Option<WriteProbe>
fn write_probe(&self) -> Option<WriteProbe>
A probe of whether this account can write a path (SPEC 8.2
read_only_target), to run on a worker thread; it never writes.
None: this view cannot probe, so every target counts as
WriteAccess::Unknown.Source§fn note_dependency(&self, _path: &Path)
fn note_dependency(&self, _path: &Path)
Notes that what the caller works out depends on the content of
path, which it reads some other way (git2 reading a repository’s
index). Nothing here; a recording view takes note (the plan cache,
crate::apply::cache).Auto Trait Implementations§
impl Forget for RealFs
impl Freeze for RealFs
impl Move for RealFs
impl RefUnwindSafe for RealFs
impl Send for RealFs
impl Sync for RealFs
impl Unpin for RealFs
impl UnsafeUnpin for RealFs
impl UnwindSafe for RealFs
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