Skip to main content

Archive

Struct Archive 

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

A structure representing a CPT archive

Archives are created by opening a file on disk or by wrapping a seekable reader using the try_from function.

Implementations§

Source§

impl<R> Archive<R>

Source

pub const TYPE_CODE: FourCC

Macintosh type code used by CPT files (PACT)

Source

pub const CREATOR_CODE: FourCC

Macintosh creator code used by CPT files (CPCT)

Source

pub fn into_inner(self) -> R

Returns the underlying reader, note that it’s read position will have changed from when you passed it in

Source§

impl<A: Read + Seek> Archive<Reader<A>>

Source

pub fn try_from(inner: A) -> Result<Self, Error>

Creates an Archive from the given reader

Source§

impl<R: Read + Seek> Archive<R>

Source

pub fn iter(&self) -> Result<EntryIterator<R>, Error>

Creates an iterator over all archive entries.

This method panics if another [EntryIterator] is currently alive for this archive to avoid over sharing the underlying reader’s seek position.

Source

pub fn verify_entry(&mut self, entry: &Entry) -> Result<(), VerificationError>

Verifies the given entry, returning a verification error if anything goes wrong

Source

pub fn open_entry( &mut self, entry: &Entry, fork: Fork, ) -> Result<EntryReader<'_, R>, Error>

Opens the specified fork of an entry for reading

Source§

impl Archive<Reader<File>>

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self, Error>

Opens an Archive from the file system while transparently undoing MacBinar encoding of the archive (not its entries).

Auto Trait Implementations§

§

impl<R> !Send for Archive<R>

§

impl<R> !Sync for Archive<R>

§

impl<R> Freeze for Archive<R>

§

impl<R> RefUnwindSafe for Archive<R>
where R: RefUnwindSafe,

§

impl<R> Unpin for Archive<R>

§

impl<R> UnsafeUnpin for Archive<R>

§

impl<R> UnwindSafe for Archive<R>
where R: RefUnwindSafe,

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.