pub enum Chunk {
Form {
secondary_id: ChunkId,
length: u32,
children: Vec<Chunk>,
},
Leaf {
id: ChunkId,
data: Vec<u8>,
},
}Expand description
A parsed IFF chunk — either a FORM container or a leaf data chunk.
Variants§
Form
A FORM container with a secondary ID and child chunks.
Fields
Leaf
A leaf chunk with raw data.
Implementations§
Source§impl Chunk
impl Chunk
Sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
For leaf chunks, return the data slice. For FORM chunks, returns empty slice.
Sourcepub fn children(&self) -> &[Chunk]
pub fn children(&self) -> &[Chunk]
For FORM chunks, return children. For leaf chunks, returns empty slice.
Sourcepub fn payload_length(&self) -> u32
pub fn payload_length(&self) -> u32
Return the declared payload length from the IFF length field.
For Form chunks, this is the value read from the IFF header — it
covers the secondary ID (4 bytes) and all children. For Leaf
chunks, this equals data().len().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnsafeUnpin for Chunk
impl UnwindSafe for Chunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more