[−][src]Struct binser::Writer
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]
T: Encode,
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]
T: Encode,
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]
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>,