[][src]Struct ttb::Writer

#[must_use =
  "the `finish` method must be called to correctly end the stream and write all data"]pub struct Writer<W: Write> { /* fields omitted */ }

Wraps a type implementing Write and can be used to write in the TTB format.

Implementations

impl<W: Write> Writer<W>[src]

pub fn new(writer: W) -> Self[src]

Create a new Writer from a type implementing Write.

pub fn into_inner(self) -> W[src]

Extract the underlying type implementing Write, destroying this Writer.

pub fn write_header(
    &mut self,
    build_name: &str,
    build_description: &str,
    palette: &[RgbaU8]
) -> Result<()>
[src]

Write the TTB header, this contains the build's name and description and the palette.

Panics

If this Writer has already written this header, this will panic.

The byte length of build_name must be less than 256, else this will panic.

The byte length of build_description must be less than 65536, else this will panic.

pub fn write_brick(
    &mut self,
    brick_type_name: &str,
    x: i32,
    y: i32,
    z: i32,
    orientation: u8,
    color: u8
) -> Result<()>
[src]

Write a brick's data, which possibly will also add its type to the brick type table.

Panics

If the header has not yet been written, this will panic.

If the color is greater than or equal to the palette's size, this will panic.

If the orientation is greater than or equal to 4, this will panic.

If the brick's type name is longer than 255 bytes, this will panic.

pub fn finish(self) -> Result<()>[src]

Finish writing, this must be called after all write operations have been done.

Auto Trait Implementations

impl<W> RefUnwindSafe for Writer<W> where
    W: RefUnwindSafe

impl<W> Send for Writer<W> where
    W: Send

impl<W> Sync for Writer<W> where
    W: Sync

impl<W> Unpin for Writer<W> where
    W: Unpin

impl<W> UnwindSafe for Writer<W> where
    W: UnwindSafe

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.