[−][src]Struct ttb::Writer
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]
&mut self,
build_name: &str,
build_description: &str,
palette: &[RgbaU8]
) -> Result<()>
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]
&mut self,
brick_type_name: &str,
x: i32,
y: i32,
z: i32,
orientation: u8,
color: u8
) -> Result<()>
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,
W: RefUnwindSafe,
impl<W> Send for Writer<W> where
W: Send,
W: Send,
impl<W> Sync for Writer<W> where
W: Sync,
W: Sync,
impl<W> Unpin for Writer<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for Writer<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,