[][src]Struct binser::Writer

pub struct Writer { /* fields omitted */ }

A trait representing values that can be read from a Reader.

Implementations

impl Writer[src]

pub fn new() -> Writer[src]

Creates a new Writer instance with an empty buffer.

pub fn with_capacity(capacity: usize) -> Writer[src]

Creates a new Writer instance with an empty buffer and a capacity.

pub fn write_bytes(&mut self, data: &[u8])[src]

Writes bytes at the end of the buffer.

pub fn write_bytes_at(&mut self, data: &[u8], offset: usize)[src]

Writes bytes at a specified offset in the buffer.

If offset is larger than the buffers size, the empty space will be padded with zeroes.

pub fn write_at<T>(&mut self, data: T, offset: usize) where
    T: Encode
[src]

Writes a value implementing Encode at a specified offset in the buffer.

If offset is larger than the buffers size, the empty space will be padded with zeroes.

pub fn write<T>(&mut self, data: T) where
    T: Encode
[src]

Writes a value implementing Encode at the end of the buffer.

pub fn data(&self) -> &[u8][src]

Returns the encoded data.

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

Transfers ownership of the encoded data.

pub fn clear(&mut self)[src]

Clears the writers internal buffer while retaining capacity to allow for more efficient memory reuse.

Auto Trait Implementations

impl RefUnwindSafe for Writer

impl Send for Writer

impl Sync for Writer

impl Unpin for Writer

impl UnwindSafe for Writer

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.