Struct Chunk

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

A chunk, also known as a form

Implementations§

Source§

impl Chunk

Source

pub fn id(&self) -> ChunkId

Returns the ChunkId of this chunk.

Source

pub fn len(&self) -> u32

Returns the number of bytes in this chunk.

Source

pub fn offset(&self) -> u64

Returns the offset of this chunk from the start of the stream.

Source

pub fn read_type<T>(&self, stream: &mut T) -> Result<ChunkId>
where T: Read + Seek,

Reads the chunk type of this chunk.

Generally only valid for RIFF and LIST chunks.

Source

pub fn read<T>(stream: &mut T, pos: u64) -> Result<Chunk>
where T: Read + Seek,

Reads a chunk from the specified position in the stream.

Source

pub fn read_contents<T>(&self, stream: &mut T) -> Result<Vec<u8>>
where T: Read + Seek,

Reads the entirety of the contents of a chunk.

Source

pub fn iter<'a, T>(&self, stream: &'a mut T) -> Iter<'a, T>
where T: Seek + Read,

Returns an iterator over the children of the chunk.

If the chunk has children but is noncompliant, e.g. it has no type identifier (like seqt chunks), use iter_no_type instead.

Source

pub fn iter_no_type<'a, T>(&self, stream: &'a mut T) -> Iter<'a, T>
where T: Seek + Read,

Returns an iterator over the chilren of the chunk. Only valid for noncompliant chunks that have children but no chunk type identifier (like seqt chunks).

Trait Implementations§

Source§

impl Debug for Chunk

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Chunk

Source§

fn eq(&self, other: &Chunk) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Chunk

Source§

impl StructuralPartialEq for Chunk

Auto Trait Implementations§

§

impl Freeze for Chunk

§

impl RefUnwindSafe for Chunk

§

impl Send for Chunk

§

impl Sync for Chunk

§

impl Unpin for Chunk

§

impl UnwindSafe for Chunk

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.