[][src]Struct riffu::builder::riff::ChunkBuilder

pub struct ChunkBuilder {
    pub chunk_id: FourCC,
    pub payload_len: u32,
    pub chunk_type: Option<FourCC>,
    pub data: ChunkData,
}

Helper struct to help user creates chunks.

NOTE

  1. Add lots and lots of error checking. Since Vec use usize internally, we have to limit it to u32. In similar vein, we also need to check for overflow and stuff, especially during subtraction.
  2. Should we separate Type and NoType? We currently represent these types at the most raw level (literally as Vec<u8>) which is quite hard to deal with.
  3. Should we lazily calculate the size of the payload or do we want to precalculate the payload as we append chunks. The latter method is error prone because a user could append to an inner chunk and the parent chunk would have no way of knowing about this size increase.

Fields

chunk_id: FourCCpayload_len: u32chunk_type: Option<FourCC>data: ChunkData

Implementations

impl ChunkBuilder[src]

pub fn new_notype(id: FourCC, data: ChunkData) -> Self[src]

Creates a chunk from a FourCC and a ChunkData that does not contain a 4 bytes identifier for the chunk type.

pub fn new_type(id: FourCC, chunk_type: FourCC, data: ChunkData) -> Self[src]

Creates a chunk from 2 FourCCs and a ChunkData that uses the second FourCC and the chunk's type identifier.

pub fn add_chunk(self, chunk: ChunkBuilder) -> RiffResult<Self>[src]

Adds a chunk children to this chunk.

Trait Implementations

impl Debug for ChunkBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.