struct DevicesFilesystem;
Trait Implementations§
Source§impl FileSystem for DevicesFilesystem
impl FileSystem for DevicesFilesystem
Source§fn open_root(&self) -> Result<DirectoryNode, FileSystemError>
fn open_root(&self) -> Result<DirectoryNode, FileSystemError>
Open the root directory of the filesystem
Source§fn read_dir(
&self,
inode: &DirectoryNode,
handler: &mut dyn FnMut(Node) -> DirTraverse,
) -> Result<(), FileSystemError>
fn read_dir( &self, inode: &DirectoryNode, handler: &mut dyn FnMut(Node) -> DirTraverse, ) -> Result<(), FileSystemError>
Read the directory entries in the
inode
, and call the handler for each entry
The handler
should return DirTraverse::Stop
to stop the traversalSource§fn unmount(self: Arc<Self>)
fn unmount(self: Arc<Self>)
Unmount the filesystem, this is called before the filesystem is dropped
The reason we use this is that we can’t force
Drop
to be implemented
for Arc<dyn FileSystem>
, so we have this insteadSource§fn traverse_dir(
&self,
inode: &DirectoryNode,
matcher: &str,
) -> Result<Node, FileSystemError>
fn traverse_dir( &self, inode: &DirectoryNode, matcher: &str, ) -> Result<Node, FileSystemError>
Traverse the directory in the
inode
and return the entry with the name matcher
Most of the time, no need to implement this, as it is already implemented in the default
using FileSystem::read_dir
Source§fn create_node(
&self,
_parent: &DirectoryNode,
_name: &str,
_attributes: FileAttributes,
) -> Result<Node, FileSystemError>
fn create_node( &self, _parent: &DirectoryNode, _name: &str, _attributes: FileAttributes, ) -> Result<Node, FileSystemError>
Create a new entry in the
parent
directory with the name
and attributes
This could be a file or a directory, the attributes
should specify the typeSource§fn read_file(
&self,
inode: &FileNode,
position: u64,
buf: &mut [u8],
_access_helper: &mut AccessHelper,
) -> Result<u64, FileSystemError>
fn read_file( &self, inode: &FileNode, position: u64, buf: &mut [u8], _access_helper: &mut AccessHelper, ) -> Result<u64, FileSystemError>
Read the file in the
inode
at the position
and put the data in buf
The access_helper
is used to store some extra metadata to help the filesystem
manage the caches or any extra data it needs.Source§fn write_file(
&self,
inode: &mut FileNode,
position: u64,
buf: &[u8],
_access_helper: &mut AccessHelper,
) -> Result<u64, FileSystemError>
fn write_file( &self, inode: &mut FileNode, position: u64, buf: &[u8], _access_helper: &mut AccessHelper, ) -> Result<u64, FileSystemError>
Write the file in the
inode
at the position
with the data in buf
The access_helper
is used to store some extra metadata to help the filesystem
manage the caches or any extra data it needs.Source§fn flush_file(
&self,
_inode: &mut FileNode,
_access_helper: &mut AccessHelper,
) -> Result<(), FileSystemError>
fn flush_file( &self, _inode: &mut FileNode, _access_helper: &mut AccessHelper, ) -> Result<(), FileSystemError>
Tells the filesystem to flush the content of this file to disk or to the backing store
if it needs to
Source§fn close_file(
&self,
_inode: &FileNode,
_access_helper: AccessHelper,
) -> Result<(), FileSystemError>
fn close_file( &self, _inode: &FileNode, _access_helper: AccessHelper, ) -> Result<(), FileSystemError>
Close the file in the
inode
, this is called when the file is dropped
The access_helper
is used to store some extra metadata to help the filesystem
manage the caches or any extra data it needs.Source§fn set_file_size(
&self,
inode: &mut FileNode,
size: u64,
) -> Result<(), FileSystemError>
fn set_file_size( &self, inode: &mut FileNode, size: u64, ) -> Result<(), FileSystemError>
Set the size of the file in the
inode
to size
, this is used to truncate the file
or to extend itAuto Trait Implementations§
impl Freeze for DevicesFilesystem
impl RefUnwindSafe for DevicesFilesystem
impl Send for DevicesFilesystem
impl Sync for DevicesFilesystem
impl Unpin for DevicesFilesystem
impl UnwindSafe for DevicesFilesystem
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.