Enum chd::header::Header

source ·
pub enum Header {
    V1Header(HeaderV1),
    V2Header(HeaderV1),
    V3Header(HeaderV3),
    V4Header(HeaderV4),
    V5Header(HeaderV5),
}
Expand description

A CHD header of unspecified version.

Variants§

§

V1Header(HeaderV1)

A CHD V1 header.

§

V2Header(HeaderV1)

A CHD V2 header.

§

V3Header(HeaderV3)

A CHD V3 header.

§

V4Header(HeaderV4)

A CHD V4 header.

§

V5Header(HeaderV5)

A CHD V5 header.

Implementations§

source§

impl Header

source

pub fn try_read_header<F: Read + Seek>(file: &mut F) -> Result<Header>

Reads CHD header data from the provided stream.

If the header is not valid, returns Error::InvalidParameter. If the header indicates an unsupported compression format, returns Error::UnsupportedFormat

source

pub fn is_compressed(&self) -> bool

Returns whether or not the CHD file is compressed.

source

pub fn meta_offset(&self) -> Option<u64>

Returns the offset of the CHD metadata, if available.

source

pub fn flags(&self) -> Option<u32>

Returns the flags of the CHD file, if available.

source

pub fn hunk_count(&self) -> u32

Returns the total number of hunks in the CHD file.

source

pub fn hunk_size(&self) -> u32

Returns the size of each hunk in the CHD file in bytes.

source

pub fn logical_bytes(&self) -> u64

Returns the logical size of the compressed data in bytes.

source

pub fn unit_bytes(&self) -> u32

Returns the number of bytes per unit within each hunk.

source

pub fn unit_count(&self) -> u64

Returns the number of units per hunk.

source

pub fn has_parent(&self) -> bool

Returns whether or not this CHD file has a parent.

source

pub fn version(&self) -> Version

Returns the CHD header version.

source

pub fn sha1(&self) -> Option<[u8; 20]>

Returns the SHA1 of the CHD file if available.

source

pub fn parent_sha1(&self) -> Option<[u8; 20]>

Returns the SHA1 of the parent of the CHD if available.

source

pub fn raw_sha1(&self) -> Option<[u8; 20]>

Returns the raw (hunk data only) SHA1 of the CHD file if available.

source

pub fn md5(&self) -> Option<[u8; 16]>

Returns the MD5 of the CHD file if available.

source

pub fn parent_md5(&self) -> Option<[u8; 16]>

Returns the MD5 of the parent CHD file if available.

source

pub fn len(&self) -> u32

Returns the length of the header.

Trait Implementations§

source§

impl Clone for Header

source§

fn clone(&self) -> Header

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. 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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.