pub struct FileResource { /* private fields */ }Expand description
A filesystem path bound to the filesystem that owns it.
FileResource is the high-level resource object returned by
FileSystems::resource and
FileSystemRegistry::resource. It
keeps path operations close to the resolved filesystem without making
FsPath itself carry any backend state.
Implementations§
Source§impl FileResource
impl FileResource
Sourcepub fn new(fs: Arc<dyn FileSystem>, path: FsPath) -> Self
pub fn new(fs: Arc<dyn FileSystem>, path: FsPath) -> Self
Sourcepub fn fs(&self) -> &dyn FileSystem
pub fn fs(&self) -> &dyn FileSystem
Returns the filesystem that owns this resource.
§Returns
A shared reference to the owning filesystem.
Sourcepub fn path(&self) -> &FsPath
pub fn path(&self) -> &FsPath
Returns the filesystem-local path of this resource.
§Returns
A shared reference to the filesystem-local path.
Sourcepub fn metadata(&self) -> FsResult<FileMetadata>
pub fn metadata(&self) -> FsResult<FileMetadata>
Sourcepub fn list(&self, options: &ListOptions) -> FsResult<Box<dyn DirectoryStream>>
pub fn list(&self, options: &ListOptions) -> FsResult<Box<dyn DirectoryStream>>
Sourcepub fn open_reader(
&self,
options: &ReadOptions,
) -> FsResult<Box<dyn FileReader>>
pub fn open_reader( &self, options: &ReadOptions, ) -> FsResult<Box<dyn FileReader>>
Sourcepub fn open_writer(
&self,
options: &WriteOptions,
) -> FsResult<Box<dyn FileWriter>>
pub fn open_writer( &self, options: &WriteOptions, ) -> FsResult<Box<dyn FileWriter>>
Sourcepub fn write_all(&self, bytes: &[u8]) -> FsResult<WriteOutcome>
pub fn write_all(&self, bytes: &[u8]) -> FsResult<WriteOutcome>
Sourcepub fn create_dir(&self, options: &CreateDirOptions) -> FsResult<()>
pub fn create_dir(&self, options: &CreateDirOptions) -> FsResult<()>
Sourcepub fn delete(&self, options: &DeleteOptions) -> FsResult<()>
pub fn delete(&self, options: &DeleteOptions) -> FsResult<()>
Sourcepub fn copy_to(
&self,
target: &FsPath,
options: &CopyOptions,
) -> FsResult<CopyOutcome>
pub fn copy_to( &self, target: &FsPath, options: &CopyOptions, ) -> FsResult<CopyOutcome>
Trait Implementations§
Source§impl Clone for FileResource
impl Clone for FileResource
Source§fn clone(&self) -> FileResource
fn clone(&self) -> FileResource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FileResource
impl !RefUnwindSafe for FileResource
impl Send for FileResource
impl Sync for FileResource
impl Unpin for FileResource
impl UnsafeUnpin for FileResource
impl !UnwindSafe for FileResource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoValueDefault<T> for T
impl<T> IntoValueDefault<T> for T
Source§fn into_value_default(self) -> T
fn into_value_default(self) -> T
Converts this argument into the default value.