Skip to main content

Ad1Reader

Struct Ad1Reader 

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

A reader over an AD1 logical image (its first segment plus any .ad2…).

Implementations§

Source§

impl Ad1Reader

Source

pub fn open(first_segment: &Path) -> Result<Self, Ad1Error>

Open an AD1 image given the path to its first segment (*.ad1); subsequent segments are discovered alongside it.

§Errors
Source

pub fn entries(&self) -> &[Ad1Entry]

The logical file tree (depth-first, directories before their children).

Source

pub fn image_version(&self) -> u32

AD1 format version recorded in the logical header (commonly 3 or 4).

Source

pub fn chunk_size(&self) -> u32

Maximum decompressed bytes per zlib data chunk.

Source

pub fn segment_count(&self) -> u32

Number of segments declared by the image header.

Source

pub fn missing_segments(&self) -> Vec<u32>

1-based indices of segments the header declares but that are absent on disk (feeds the AD1-SEGMENT-MISSING audit). Empty for a complete image.

Source

pub fn read_at( &self, entry: &Ad1Entry, offset: u64, buf: &mut [u8], ) -> Result<usize, Ad1Error>

Read up to buf.len() decompressed bytes of entry starting at offset, inflating only the zlib chunks the range overlaps.

Returns the number of bytes written (0 at or past end of file, or for a directory).

§Errors

Ad1Error::Malformed / Ad1Error::Io on a corrupt chunk table or decompression failure.

Trait Implementations§

Source§

impl Debug for Ad1Reader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.