Struct minicbor_io::Writer[][src]

pub struct Writer<W> { /* fields omitted */ }

Wraps a std::io::Write and writes length-delimited CBOR values.

Implementations

impl<W> Writer<W>[src]

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

Create a new writer with a max. buffer size of 512KiB.

pub fn with_buffer(writer: W, buffer: Vec<u8>) -> Self[src]

Create a new writer with a max. buffer size of 512KiB.

pub fn set_max_len(&mut self, val: u32)[src]

Set the max. buffer size in bytes.

If length values greater than this are encoded, an Error::InvalidLen will be returned.

pub fn writer(&self) -> &W[src]

Get a reference to the inner writer.

pub fn writer_mut(&mut self) -> &mut W[src]

Get a mutable reference to the inner writer.

pub fn into_parts(self) -> (W, Vec<u8>)[src]

Deconstruct this writer into the inner writer and the buffer.

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

pub fn write<T: Encode>(&mut self, val: T) -> Result<usize, Error>[src]

Encode and write a CBOR value and return its size in bytes.

pub fn flush(&mut self) -> Result<(), Error>[src]

Flush the inner Writer.

Trait Implementations

impl<W: Debug> Debug for Writer<W>[src]

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.