pub struct Encoder<W>(pub W);Expand description
A non-allocating CBOR encoder writing encoded bytes to the given Write sink.
Tuple Fields§
§0: WImplementations§
Source§impl<W: Write> Encoder<W>
impl<W: Write> Encoder<W>
Sourcepub fn array(&mut self, len: usize) -> Result<(), W::Error>
pub fn array(&mut self, len: usize) -> Result<(), W::Error>
Begin encoding an array with len elements.
Sourcepub fn begin_array(&mut self) -> Result<(), W::Error>
pub fn begin_array(&mut self) -> Result<(), W::Error>
Begin encoding an array of unknown size.
Use Encoder::end to terminate the array.
Sourcepub fn map(&mut self, len: usize) -> Result<(), W::Error>
pub fn map(&mut self, len: usize) -> Result<(), W::Error>
Begin encoding a map with len entries.
Sourcepub fn begin_map(&mut self) -> Result<(), W::Error>
pub fn begin_map(&mut self) -> Result<(), W::Error>
Begin encoding a map of unknown size.
Use Encoder::end to terminate the map.
Sourcepub fn begin_bytes(&mut self) -> Result<(), W::Error>
pub fn begin_bytes(&mut self) -> Result<(), W::Error>
Begin encoding an indefinite number of byte slices.
Use Encoder::end to terminate.
Trait Implementations§
Source§impl<W: Ord> Ord for Encoder<W>
impl<W: Ord> Ord for Encoder<W>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<W: PartialOrd> PartialOrd for Encoder<W>
impl<W: PartialOrd> PartialOrd for Encoder<W>
impl<W: Copy> Copy for Encoder<W>
impl<W: Eq> Eq for Encoder<W>
impl<W> StructuralPartialEq for Encoder<W>
Auto Trait Implementations§
impl<W> Freeze for Encoder<W>where
W: Freeze,
impl<W> RefUnwindSafe for Encoder<W>where
W: RefUnwindSafe,
impl<W> Send for Encoder<W>where
W: Send,
impl<W> Sync for Encoder<W>where
W: Sync,
impl<W> Unpin for Encoder<W>where
W: Unpin,
impl<W> UnwindSafe for Encoder<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more