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, block group descriptors, and journal. No other data is read.
Source§impl Ext4
These methods mirror the std::fs
API.
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:
path
is not absolute.path
does not exist.
This is not an exhaustive list of errors, see the crate documentation.
Sourcepub fn open<'p, P>(&self, path: P) -> Result<File, Ext4Error>
pub fn open<'p, P>(&self, path: P) -> Result<File, Ext4Error>
Open the file at path
.
§Errors
An error will be returned if:
path
is not absolute.path
does not exist.path
is a directory or special file type.
This is not an exhaustive list of errors, see the crate documentation.
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:
path
is not absolute.path
does not exist.path
is a directory or special file type.
This is not an exhaustive list of errors, see the crate documentation.
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:
path
is not absolute.path
does not exist.path
is a directory or special file type.
This is not an exhaustive list of errors, see the crate documentation.
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:
path
is not absolute.- The final component of
path
is not a symlink.
This is not an exhaustive list of errors, see the crate documentation.
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:
path
is not absolute.path
does not existpath
is not a directory
This is not an exhaustive list of errors, see the crate documentation.
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:
path
is not absolute.
This is not an exhaustive list of errors, see the crate documentation.
Sourcepub fn metadata<'p, P>(&self, path: P) -> Result<Metadata, Ext4Error>
pub fn metadata<'p, P>(&self, path: P) -> Result<Metadata, Ext4Error>
Get Metadata
for path
.
§Errors
An error will be returned if:
path
is not absolute.path
does not exist.
This is not an exhaustive list of errors, see the crate documentation.
Sourcepub fn symlink_metadata<'p, P>(&self, path: P) -> Result<Metadata, Ext4Error>
pub fn symlink_metadata<'p, P>(&self, path: P) -> Result<Metadata, Ext4Error>
Get Metadata
for path
.
If the final component of path
is a symlink, information about
the symlink itself will be returned, not the symlink’s
targets. Any other symlink components of path
are resolved as
normal.
§Errors
An error will be returned if:
path
is not absolute.path
does not exist.
This is not an exhaustive list of errors, see the crate documentation.