Skip to main content

RealFs

Struct RealFs 

Source
pub struct RealFs;
Expand description

The real file system, unconfined.

Trait Implementations§

Source§

impl Clone for RealFs

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RealFs

Source§

impl Debug for RealFs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RealFs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Fs for RealFs

Source§

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.
Source§

fn exists(&self, path: &Path) -> bool

Source§

fn is_dir(&self, path: &Path) -> bool

Source§

fn read_to_string(&self, path: &Path) -> Result<String>

Source§

fn read(&self, path: &Path) -> Result<Vec<u8>>

The bytes of a file.
Source§

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.
Source§

fn write(&self, path: &Path, contents: &[u8]) -> Result<()>

Source§

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<()>

Moves from over to, replacing it atomically. On Unix the directory is flushed afterwards.
Source§

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.
Source§

fn create_dir_all(&self, path: &Path) -> Result<()>

Source§

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).
Source§

fn remove_file(&self, path: &Path) -> Result<()>

Source§

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<()>

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.
Source§

fn remove_dir_all(&self, path: &Path) -> Result<()>

Source§

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>

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>

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>

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)

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more