pub struct Ext4 { /* private fields */ }Expand description
Read-only access to an ext4 filesystem.
Implementations§
source§impl Ext4
impl Ext4
sourcepub fn load(reader: Box<dyn Ext4Read>) -> Result<Self, Ext4Error>
pub fn load(reader: Box<dyn Ext4Read>) -> Result<Self, Ext4Error>
Load an Ext4 instance from the given reader.
This reads and validates the superblock and block group descriptors. No other data is read.
sourcepub fn load_from_path(path: &Path) -> Result<Self, Ext4Error>
Available on crate feature std only.
pub fn load_from_path(path: &Path) -> Result<Self, Ext4Error>
std only.Load an Ext4 filesystem from the given path.
This reads and validates the superblock and block group descriptors. No other data is read.
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