Skip to main content

Archive

Struct Archive 

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

Reader for BinHex archives

Implementations§

Source§

impl<R> Archive<R>

Source

pub fn name(&self) -> &str

Original name of the embedded file

Source

pub fn file_code(&self) -> FourCC

The file’s four-byte type identifier

Source

pub fn creator_code(&self) -> FourCC

The file’s four-byte creator code

Source

pub fn finder_flags(&self) -> FinderFlags

Finder flags at the time of compression

Source

pub fn data_len(&self) -> usize

Number of bytes in the uncompressed data fork

Source

pub fn resource_len(&self) -> usize

Number of bytes in the uncompressed resource fork

Source

pub fn header_checksum(&self) -> u16

CRC-16 checksum of the header bytes

The CRC-16 configuration is CRC-16-XMODEM the CRC of ASCII “123456789” is 0x31C3.

Source§

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

Source

pub const HEADER: &[u8; 45] = b"(This file must be converted with BinHex 4.0)"

Fixed header that introduces the start of encoded data

Source

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

Try to read an archive from the reader.

It searches for the start marker and reads the archive header after that. Returns an error if either fails.

Source

pub fn data_fork( &mut self, ) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>

Open the data fork for reading

Since reading backwards through RLE encoded data is expensive, this should be called before accessing the resource fork, if the application wants to read both

Source

pub fn resource_fork( &mut self, ) -> Result<ForkReader<&mut SixBitRleReader<R>>, Error>

Open the resource fork for reading

Since reading backwards through RLE encoded data is expensive, this should be called after accessing the data fork, if the application wants to read both

Source

pub fn verify(&mut self) -> Result<(), VerificationError>

Verify checksums of the whole archive, this resets the stream and reads the whole file to calculate the checksums.

Source

pub fn into_inner(self) -> R

Returns the underlying reader that was used initially to open the archive Note that the read position has probably changed

Source§

impl Archive<File>

Source

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

Try to open the archive specified by path

Source

pub fn try_clone(&self) -> Result<Self>

Try to clone the archive which would allow you to read resource and data forks simultaneously

Trait Implementations§

Source§

impl<R: Clone> Clone for Archive<R>

Source§

fn clone(&self) -> Self

Clone the archive, allowing you to access resource and data forks at the same time

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.