Skip to main content

HeifFile

Struct HeifFile 

Source
pub struct HeifFile<'a> {
    pub major_brand: [u8; 4],
    pub compatible_brands: Vec<[u8; 4]>,
    pub handler: [u8; 4],
    pub primary: Option<u32>,
    pub items: Vec<Item>,
    pub properties: Vec<Property<'a>>,
    pub references: Vec<Reference>,
    pub limits: Limits,
    /* private fields */
}
Expand description

A parsed HEIF file: brands, items, properties and references, borrowing the file buffer.

Fields§

§major_brand: [u8; 4]§compatible_brands: Vec<[u8; 4]>§handler: [u8; 4]§primary: Option<u32>§items: Vec<Item>§properties: Vec<Property<'a>>§references: Vec<Reference>§limits: Limits

Implementations§

Source§

impl<'a> HeifFile<'a>

Source

pub fn parse(data: &'a [u8], limits: Limits) -> Result<HeifFile<'a>>

Parse the ftyp and top-level meta of a HEIF file held in memory.

Source

pub fn item(&self, id: u32) -> Option<&Item>

The item with id, if iinf declares one.

Source

pub fn primary_item(&self) -> Option<&Item>

The primary item, if pitm names one that iinf declares.

Source

pub fn properties_of( &self, id: u32, ) -> impl Iterator<Item = (&Property<'a>, bool)> + '_

Item id’s properties in ipma order, with their essential flag.

Source

pub fn ispe(&self, id: u32) -> Option<(u32, u32)>

The first ispe of item id.

Source

pub fn hvcc(&self, id: u32) -> Option<&'a [u8]>

The first hvcC of item id.

Source

pub fn aux_type(&self, id: u32) -> Option<&str>

The auxC type URN of item id, if it is an auxiliary image.

Source

pub fn refs_from(&self, id: u32, kind: &[u8; 4]) -> Vec<u32>

Items id refers to with kind, in reference order.

Source

pub fn refs_to(&self, id: u32, kind: &[u8; 4]) -> Vec<u32>

Items that refer to id with kind (e.g. the thumbnails of id are the items with a thmb reference to it).

Source

pub fn item_data(&self, id: u32) -> Result<Cow<'a, [u8]>>

Item id’s bytes: a borrow of the file (or idat) when it is one extent, a concatenation when it is several.

Source

pub fn grid(&self, id: u32) -> Result<Grid>

Parse item id as a grid descriptor, checked against Limits.

Source

pub fn overlay(&self, id: u32) -> Result<Overlay>

Parse item id as an iovl descriptor, checked against Limits.

Source

pub fn check_size(&self, w: u32, h: u32) -> Result<()>

Refuse an image size outside Limits (or empty).

Source

pub fn has_brand(&self, brand: &[u8; 4]) -> bool

True if the brands say this file holds HEIF still images (mif1, heic, …), as opposed to only image sequences (msf1).

Trait Implementations§

Source§

impl<'a> Clone for HeifFile<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for HeifFile<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for HeifFile<'a>

§

impl<'a> Freeze for HeifFile<'a>

§

impl<'a> Move for HeifFile<'a>

§

impl<'a> RefUnwindSafe for HeifFile<'a>

§

impl<'a> Send for HeifFile<'a>
where &'a [u8]: Send, RawVecInner: Send,

§

impl<'a> Sync for HeifFile<'a>
where RawVecInner: Sync,

§

impl<'a> Unpin for HeifFile<'a>
where &'a [u8]: Unpin, *const u8 is !null: Unpin,

§

impl<'a> UnsafeUnpin for HeifFile<'a>

§

impl<'a> UnwindSafe for HeifFile<'a>
where &'a [u8]: UnwindSafe, RawVecInner: 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.