Struct bincode_core::BufferWriter[][src]

pub struct BufferWriter<'a> { /* fields omitted */ }

An implementation of CoreWrite. This buffer writer will write data to a backing &mut [u8].

Implementations

impl<'a> BufferWriter<'a>[src]

pub fn new(buffer: &'a mut [u8]) -> Self[src]

Create a new writer with a backing buffer.

pub fn written_len(&self) -> usize[src]

The bytes count written to the backing buffer.

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

A slice of the buffer that is in this writer. This is equivalent to getting a slice of the original buffer with the range ..writer.written_len().


// These two statements are equivalent
let buffer_slice = &buffer[..writer.written_len() as usize];
let writer_slice = writer.written_buffer();

assert_eq!(buffer_slice, writer_slice);

Trait Implementations

impl CoreWrite for &mut BufferWriter<'_>[src]

type Error = BufferWriterError

The error that this writer can encounter

impl CoreWrite for BufferWriter<'_>[src]

type Error = BufferWriterError

The error that this writer can encounter

Auto Trait Implementations

impl<'a> RefUnwindSafe for BufferWriter<'a>

impl<'a> Send for BufferWriter<'a>

impl<'a> Sync for BufferWriter<'a>

impl<'a> Unpin for BufferWriter<'a>

impl<'a> !UnwindSafe for BufferWriter<'a>

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.