pub struct Decoder<'a> { /* private fields */ }Available on crate feature
cbor only.Expand description
The low level implementation of the CBOR decoder with only the handful of desired types supported.
Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
Sourcepub fn finish(self) -> Result<(), Error>
pub fn finish(self) -> Result<(), Error>
Terminates decoding and returns an error if trailing bytes remain.
Sourcepub fn decode_uint(&mut self) -> Result<u64, Error>
pub fn decode_uint(&mut self) -> Result<u64, Error>
Decodes a positive integer, enforcing minimal canonicalness.
Sourcepub fn decode_int(&mut self) -> Result<i64, Error>
pub fn decode_int(&mut self) -> Result<i64, Error>
Decodes a signed integer (major type 0 or 1).
Sourcepub fn decode_bytes_fixed<const N: usize>(&mut self) -> Result<[u8; N], Error>
pub fn decode_bytes_fixed<const N: usize>(&mut self) -> Result<[u8; N], Error>
Decodes a byte string into a fixed-size array.
Sourcepub fn decode_text(&mut self) -> Result<String, Error>
pub fn decode_text(&mut self) -> Result<String, Error>
Decodes a UTF-8 text string.
Sourcepub fn decode_array_header(&mut self) -> Result<u64, Error>
pub fn decode_array_header(&mut self) -> Result<u64, Error>
Decodes an array header, returning its length.
Sourcepub fn decode_map_header(&mut self) -> Result<u64, Error>
pub fn decode_map_header(&mut self) -> Result<u64, Error>
Decodes a map header, returning the number of key-value pairs.
Sourcepub fn decode_bool(&mut self) -> Result<bool, Error>
pub fn decode_bool(&mut self) -> Result<bool, Error>
Decodes a CBOR boolean value.
Sourcepub fn decode_null(&mut self) -> Result<(), Error>
pub fn decode_null(&mut self) -> Result<(), Error>
Decodes a CBOR null value.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnsafeUnpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'a>
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