pub struct Reader<'a> { /* private fields */ }Expand description
CBOR Data structure to read CBOR elements from a slice of byte
Implementations
sourceimpl<'a> Reader<'a>
impl<'a> Reader<'a>
sourcepub fn remaining_bytes(&self) -> usize
pub fn remaining_bytes(&self) -> usize
Return the number of bytes remaining to be processed by the reader
sourcepub fn consumed_bytes(&self) -> usize
pub fn consumed_bytes(&self) -> usize
Return the number of bytes consumed since the start of the Reader
sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Return if all the bytes have been consumed by the reader
sourcepub fn expect_finished(&self) -> Result<(), ReaderError>
pub fn expect_finished(&self) -> Result<(), ReaderError>
Assume the reader is finished (no more bytes to process), or
otherwise return a ReaderError::NotTerminated
pub fn new(data: &'a [u8]) -> Self
sourcepub fn peek_type(&self) -> Result<Type, ReaderError>
pub fn peek_type(&self) -> Result<Type, ReaderError>
Peek at the next type in the buffer
Note that it can still return error if there’s no data available (end of buffer), or that the CBOR lead byte is not well-formed
pub fn positive(&mut self) -> Result<Positive, ReaderError>
pub fn negative(&mut self) -> Result<Negative, ReaderError>
pub fn byte(&mut self) -> Result<Byte, ReaderError>
pub fn float(&mut self) -> Result<Float, ReaderError>
pub fn constant(&mut self) -> Result<Constant, ReaderError>
pub fn null(&mut self) -> Result<(), ReaderError>
pub fn undefined(&mut self) -> Result<(), ReaderError>
pub fn bool(&mut self) -> Result<bool, ReaderError>
pub fn bytes(&mut self) -> Result<Bytes<'a>, ReaderError>
pub fn text(&mut self) -> Result<Text<'a>, ReaderError>
pub fn array(&mut self) -> Result<Array<'a>, ReaderError>
pub fn map(&mut self) -> Result<Map<'a>, ReaderError>
pub fn tag(&mut self) -> Result<Tag<'a>, ReaderError>
pub fn data(&mut self) -> Result<Data<'a>, ReaderError>
pub fn decode<T: Decode>(&mut self) -> Result<T, DecodeError>
pub fn decode_one<T: Decode>(&mut self) -> Result<T, DecodeError>
pub fn decodable_slice<T: Decode + 'static>(
&mut self
) -> Result<&'a CborSliceOf<T>, DecodeError>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more