StdFileSystem

Struct StdFileSystem 

Source
pub struct StdFileSystem;
Available on crate feature fs only.
Expand description

The wrapper of std::fs that implement FileSystem trait.

Trait Implementations§

Source§

impl Default for StdFileSystem

Source§

fn default() -> StdFileSystem

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

impl FileSystem for StdFileSystem

Source§

fn open_file( &self, _waker: Waker, path: &Path, open_mode: &FileOpenMode, ) -> CancelablePoll<Result<Handle>>

Opens a file with FileOpenMode
Source§

fn file_write( &self, _waker: Waker, file: &Handle, buf: &[u8], ) -> CancelablePoll<Result<usize>>

Write a buffer into this writer, returning how many bytes were written
Source§

fn file_read( &self, _waker: Waker, file: &Handle, buf: &mut [u8], ) -> CancelablePoll<Result<usize>>

Pull some bytes from this source into the specified buffer, returning how many bytes were read.
Source§

fn file_flush(&self, _waker: Waker, file: &Handle) -> CancelablePoll<Result<()>>

Attempts to sync all OS-internal metadata to disk. Read more
Source§

fn file_seek( &self, _waker: Waker, file: &Handle, pos: SeekFrom, ) -> CancelablePoll<Result<u64>>

Seek to an offset, in bytes, in a stream. Read more
Source§

fn file_meta( &self, _waker: Waker, file: &Handle, ) -> CancelablePoll<Result<Metadata>>

Reads the file’s metadata.
Source§

fn file_set_permissions( &self, _waker: Waker, file: &Handle, perm: &Permissions, ) -> CancelablePoll<Result<()>>

Changes the permissions on the file.
Source§

fn file_set_len( &self, _waker: Waker, file: &Handle, size: u64, ) -> CancelablePoll<Result<()>>

Truncates or extends the file. Read more
Source§

fn canonicalize( &self, _waker: Waker, path: &Path, ) -> CancelablePoll<Result<PathBuf>>

Returns the canonical form of a path. The returned path is in absolute form with all intermediate components normalized and symbolic links resolved. This function is an async version of std::fs::canonicalize.
Source§

fn copy( &self, _waker: Waker, from: &Path, to: &Path, ) -> CancelablePoll<Result<u64>>

Copies the contents and permissions of a file to a new location. On success, the total number of bytes copied is returned and equals the length of the to file after this operation. The old contents of to will be overwritten. If from and to both point to the same file, then the file will likely get truncated as a result of this operation.
Source§

fn create_dir(&self, _waker: Waker, path: &Path) -> CancelablePoll<Result<()>>

Creates a new directory. Note that this function will only create the final directory in path. If you want to create all of its missing parent directories too, use the create_dir_all function instead. Read more
Source§

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

Creates a new directory and all of its parents if they are missing. This function is an async version of std::fs::create_dir_all.
Creates a hard link on the filesystem. The dst path will be a link pointing to the src path. Note that operating systems often require these two paths to be located on the same filesystem. Read more
Source§

fn metadata( &self, _waker: Waker, path: &Path, ) -> CancelablePoll<Result<Metadata>>

Reads metadata for a path. This function will traverse symbolic links to read metadata for the target file or directory. If you want to read metadata without following symbolic links, use symlink_metadata instead. Read more
Source§

fn read_dir(&self, _waker: Waker, path: &Path) -> CancelablePoll<Result<Handle>>

Returns a iterator handle of entries in a directory. Read more
Source§

fn dir_entry_next( &self, _waker: Waker, read_dir_handle: &Handle, ) -> CancelablePoll<Result<Option<Handle>>>

Advances the directory entry iterator and returns the next value. Read more
Source§

fn dir_entry_file_name(&self, entry: &Handle) -> String

Returns the bare name of this entry without the leading path.
Source§

fn dir_entry_path(&self, entry: &Handle) -> PathBuf

Returns the full path to this entry. The full path is created by joining the original path passed to read_dir with the name of this entry.
Source§

fn dir_entry_metadata( &self, _waker: Waker, entry: &Handle, ) -> CancelablePoll<Result<Metadata>>

Reads the metadata for this entry. Read more
Source§

fn dir_entry_file_type( &self, _waker: Waker, entry: &Handle, ) -> CancelablePoll<Result<FileType>>

eads the file type for this entry. This function will not traverse symbolic links if this entry points at one. If you want to read metadata with following symbolic links, use dir_entry_metadata instead.
Reads a symbolic link and returns the path it points to. Read more
Source§

fn remove_dir(&self, _waker: Waker, path: &Path) -> CancelablePoll<Result<()>>

Removes an empty directory, if the path is not an empty directory, use the function remove_dir_all instead. Read more
Source§

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

Removes a directory and all of its contents. Read more
Source§

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

Removes a file. This function is an async version of std::fs::remove_file.
Source§

fn rename( &self, _waker: Waker, from: &Path, to: &Path, ) -> CancelablePoll<Result<()>>

Renames a file or directory to a new location. If a file or directory already exists at the target location, it will be overwritten by this operation. This function is an async version of std::fs::rename.
Source§

fn set_permissions( &self, _waker: Waker, path: &Path, perm: &Permissions, ) -> CancelablePoll<Result<()>>

Changes the permissions of a file or directory. This function is an async version of std::fs::set_permissions.
Reads metadata for a path without following symbolic links. If you want to follow symbolic links before reading metadata of the target file or directory, use metadata instead. Read more

Auto Trait Implementations§

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.