Skip to main content

ErofsParser

Struct ErofsParser 

Source
pub struct ErofsParser { /* private fields */ }
Expand description

The parser for an EROFS image.

Implementations§

Source§

impl ErofsParser

Source

pub fn new(reader: Arc<dyn Reader>) -> Result<Self, ErofsError>

Creates a new parser for an EROFS image from a reader.

Source

pub fn block_size(&self) -> u64

Returns the block size of the EROFS image.

Source

pub fn node(&self, nid: u64) -> Result<Node, ErofsError>

Returns the node with the given nid.

Source

pub fn root_node(&self) -> DirectoryNode

Returns the root node of the EROFS image.

Source

pub fn read_file_range( &self, node: &FileNode, offset: u64, buf: &mut [u8], ) -> Result<usize, ErofsError>

Reads the data of the given file node into a buffer.

Source

pub fn read_directory( &self, node: &DirectoryNode, entry_offset: usize, entries: &mut [DirectoryEntry], ) -> Result<usize, ErofsError>

Read a number of entries from a directory, starting at entry_offset. Will retrieve up to the number of entries in the directory or the size of the provided buffer, returning the number of entries filled in the buffer. If there are less filled entries then the number of entry slots provided in the buffer, there are no more entries in this directory. Entries are sorted lexicographically. Reads past the end of the number of entries will return zero entries filled.

Source

pub fn lookup( &self, dir: &DirectoryNode, name: &str, ) -> Result<Option<Node>, ErofsError>

Looks up a node by name in a directory.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.