Struct Archive

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

An open SquashFS archive.

Implementations§

Source§

impl Archive

Source

pub fn open<T: AsRef<Path>>(path: T) -> Result<Self>

Open an existing archive for reading.

Source

pub fn path(&self) -> &Path

Retrieve the path with that was used to open the archive.

Source

pub fn size(&self) -> u32

Get the number of inodes in the archive.

Source

pub fn get_exists<T: AsRef<Path>>(&self, path: T) -> Result<Node<'_>>

Get the Node located at the given path, raising an error if it does not exist.

Source

pub fn get<T: AsRef<Path>>(&self, path: T) -> Result<Option<Node<'_>>>

Get the Node located at the given path in the archive.

If the path is not present, Ok(None) will be returned.

Source

pub fn get_id(&self, id: u64) -> Result<Node<'_>>

Get a node from the archive by its inode number.

Each inode in an archive has a unique ID. If the archive was created with the “exportable” option (intended for exporting over NFS), it is efficient to look up inodes by their IDs. If this archive is not exportable, SquashfsError::Unsupported will be raised. A Node obtained in this way will lack path information, and as such operations like getting its file name or parent will fail.

Trait Implementations§

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.
Source§

impl<T> Erased for T