pub struct CBORDecoder<'a> { /* private fields */ }

Implementations§

source§

impl<'a> CBORDecoder<'a>

source

pub fn new(bytes: &'a [u8]) -> Self

source

pub fn position(&self) -> usize

source

pub fn finished(&self) -> bool

source

pub fn ensure_finished(&self) -> Result<(), CBORError>

source

pub fn remaining_buffer(&self) -> Result<&[u8], CBORError>

source

pub fn current(&self) -> Result<u8, CBORError>

Get the byte at the current position.

source

pub fn u8(&mut self) -> Result<u8, CBORError>

Decode a u8 value.

source

pub fn i8(&mut self) -> Result<i8, CBORError>

Decode an i8 value.

source

pub fn int_raw(&mut self) -> Result<u8, CBORError>

Get the raw i8 or u8 value.

source

pub fn str(&mut self) -> Result<&'a [u8], CBORError>

Decode a string slice.

source

pub fn bytes(&mut self) -> Result<&'a [u8], CBORError>

Decode a byte slice.

source

pub fn bytes_sized( &mut self, expected_size: usize ) -> Result<&'a [u8], CBORError>

Decode a byte slice of an expected size.

source

pub fn array(&mut self) -> Result<usize, CBORError>

Begin decoding an array.

source

pub fn as_usize(&mut self, b: u8) -> Result<usize, CBORError>

Decode a u8 value into usize.

source

pub fn type_of(b: u8) -> u8

Get the major type info of the given byte (highest 3 bits).

source

pub fn info_of(b: u8) -> u8

Get the additionl type info of the given byte (lowest 5 bits).

source

pub fn is_u8(byte: u8) -> bool

Check for: an unsigned integer encoded as a single byte

source

pub fn is_i8(byte: u8) -> bool

Check for: a negative integer encoded as a single byte

Trait Implementations§

source§

impl<'a> Debug for CBORDecoder<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for CBORDecoder<'a>

§

impl<'a> Send for CBORDecoder<'a>

§

impl<'a> Sync for CBORDecoder<'a>

§

impl<'a> Unpin for CBORDecoder<'a>

§

impl<'a> UnwindSafe for CBORDecoder<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.