Struct vox_format::chunk::ChunkWriter[][src]

pub struct ChunkWriter<W> { /* fields omitted */ }
Expand description

This struct is used to write out chunks to a file.

Implementations

Returns the chunk ID

Returns the offset at which this chunk is written in the underlying writer. Similar to Chunk::offset, this is is usually 0 for child chunks, since the use a ContentWriter, which only sees the children data.

Returns the current length of the contents.

Returns the current length of the children data. This is the total number of bytes written for children chunks.

Writes data to the chunks content.

Note, that this must be called before any calls to child_writer.

Example

use std::io::Write;

chunk_writer.content_writer(|writer| {
    // `writer` implements `std::io::Write + std::io::Seek`.
    writer.write_all(b"Hello World")?;
    Ok(())
})

Panics

Panics, if children have been written already.

Writes the given slice to the chunk’s data.

Writes children chunks to this chunk. Note, that after a child has been written to a chunk, you can’t write any more data to its contents.

Example

chunk_writer.child_writer(ChunkId::Main, |child_writer| {
    // `child_writer` is just another `ChunkWriter`.
    child_writer.write_content(b"Hello World")?;
    Ok(())
})

Short-hand to opening and child-writer and then a content-writer to that child. Useful, if you want to write a child with only content data.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Convert into T with values clamped to the color defined bounds Read more

Convert into T. The resulting color might be invalid in its color space Read more

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more