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
impl Default for StdFileSystem
Source§fn default() -> StdFileSystem
fn default() -> StdFileSystem
Returns the “default value” for a type. Read more
Source§impl FileSystem for StdFileSystem
impl FileSystem for StdFileSystem
Source§fn open_file(
&self,
_waker: Waker,
path: &Path,
open_mode: &FileOpenMode,
) -> CancelablePoll<Result<Handle>>
fn open_file( &self, _waker: Waker, path: &Path, open_mode: &FileOpenMode, ) -> CancelablePoll<Result<Handle>>
Opens a file with
FileOpenModeSource§fn file_write(
&self,
_waker: Waker,
file: &Handle,
buf: &[u8],
) -> CancelablePoll<Result<usize>>
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>>
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<()>>
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>>
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>>
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<()>>
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<()>>
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>>
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>>
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<()>>
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 moreSource§fn create_dir_all(
&self,
_waker: Waker,
path: &Path,
) -> CancelablePoll<Result<()>>
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.Source§fn hard_link(
&self,
_waker: Waker,
from: &Path,
to: &Path,
) -> CancelablePoll<Result<()>>
fn hard_link( &self, _waker: Waker, from: &Path, to: &Path, ) -> CancelablePoll<Result<()>>
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>>
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>>
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>>>
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
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
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>>
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>>
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.Source§fn read_link(
&self,
_waker: Waker,
path: &Path,
) -> CancelablePoll<Result<PathBuf>>
fn read_link( &self, _waker: Waker, path: &Path, ) -> CancelablePoll<Result<PathBuf>>
Reads a symbolic link and returns the path it points to. Read more
Source§fn remove_dir(&self, _waker: Waker, path: &Path) -> CancelablePoll<Result<()>>
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 moreSource§fn remove_dir_all(
&self,
_waker: Waker,
path: &Path,
) -> CancelablePoll<Result<()>>
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<()>>
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<()>>
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<()>>
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.Source§fn symlink_metadata(
&self,
_waker: Waker,
path: &Path,
) -> CancelablePoll<Result<Metadata>>
fn symlink_metadata( &self, _waker: Waker, path: &Path, ) -> CancelablePoll<Result<Metadata>>
Auto Trait Implementations§
impl Freeze for StdFileSystem
impl RefUnwindSafe for StdFileSystem
impl Send for StdFileSystem
impl Sync for StdFileSystem
impl Unpin for StdFileSystem
impl UnwindSafe for StdFileSystem
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