Skip to main content

Fs

Struct Fs 

Source
pub struct Fs;
Expand description

The standard implementation of CacheFs that uses std and rand.

Trait Implementations§

Source§

impl Clone for Fs

Source§

fn clone(&self) -> Fs

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 Fs for Fs

Source§

type Error = Error

Error type for methods.
Source§

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

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

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 rand_u64(&self) -> u64

Return a random u64. This is used for creating unique path names.
Source§

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>

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

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

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

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

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

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

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

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

Rename source to destination. There are a bunch of rules that must be satisfied for this to succeed: Read more
Source§

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

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

fn temp_dir(&self, parent: &Path) -> Result<Self::TempDir>

Create a new temporary directory in the directory parent.
Source§

fn persist_temp_dir(&self, temp_dir: Self::TempDir, target: &Path) -> Result<()>

Rename temp_dir to target while consuming temp_dir. This is different than the caller just doing the rename itself in that it consumes temp_dir 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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,

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, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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