Struct minicbor_io::Writer [−][src]
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 Write
r.
Trait Implementations
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,
pub 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.
pub 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>,