pub struct Ext4 { /* private fields */ }Expand description
Read-only access to an ext4 filesystem.
Implementations§
source§impl Ext4
impl Ext4
source§impl Ext4
impl Ext4
These methods mirror the std::fs API.
sourcepub fn canonicalize<'p, P>(&self, path: P) -> Result<PathBuf, Ext4Error>
pub fn canonicalize<'p, P>(&self, path: P) -> Result<PathBuf, Ext4Error>
Get the canonical, absolute form of a path with all intermediate components normalized and symbolic links resolved.
§Errors
An error will be returned if:
pathis not absolute.pathdoes not exist.
sourcepub fn read<'p, P>(&self, path: P) -> Result<Vec<u8>, Ext4Error>
pub fn read<'p, P>(&self, path: P) -> Result<Vec<u8>, Ext4Error>
Read the entire contents of a file as raw bytes.
§Errors
An error will be returned if:
pathis not absolute.pathdoes not exist.pathis a directory or special file type.
sourcepub fn read_to_string<'p, P>(&self, path: P) -> Result<String, Ext4Error>
pub fn read_to_string<'p, P>(&self, path: P) -> Result<String, Ext4Error>
Read the entire contents of a file as a string.
§Errors
An error will be returned if:
pathis not absolute.pathdoes not exist.pathis a directory or special file type.
sourcepub fn read_link<'p, P>(&self, path: P) -> Result<PathBuf, Ext4Error>
pub fn read_link<'p, P>(&self, path: P) -> Result<PathBuf, Ext4Error>
Get the target of a symbolic link.
The final component of path must be a symlink. If the path
contains any symlinks in components prior to the end, they will
be fully resolved as normal.
§Errors
An error will be returned if:
pathis not absolute.- The final component of
pathis not a symlink.
sourcepub fn read_dir<'p, P>(&self, path: P) -> Result<ReadDir<'_>, Ext4Error>
pub fn read_dir<'p, P>(&self, path: P) -> Result<ReadDir<'_>, Ext4Error>
Get an iterator over the entries in a directory.
§Errors
An error will be returned if:
pathis not absolute.pathdoes not existpathis not a directory
sourcepub fn exists<'p, P>(&self, path: P) -> Result<bool, Ext4Error>
pub fn exists<'p, P>(&self, path: P) -> Result<bool, Ext4Error>
Check if path exists.
Returns Ok(true) if path exists, or Ok(false) if it does
not exist.
§Errors
An error will be returned if:
pathis not absolute.