[][src]Struct cbor::decoder::Decoder

pub struct Decoder<R> { /* fields omitted */ }

The actual decoder type definition

Implementations

impl<R: ReadBytesExt> Decoder<R>[src]

pub fn new(c: Config, r: R) -> Decoder<R>[src]

pub fn into_reader(self) -> R[src]

pub fn kernel(&mut self) -> &mut Kernel<R>[src]

pub fn simple(&mut self) -> DecodeResult<Simple>[src]

pub fn bool(&mut self) -> DecodeResult<bool>[src]

pub fn _bool(&mut self, ti: &TypeInfo) -> DecodeResult<bool>[src]

pub fn u8(&mut self) -> DecodeResult<u8>[src]

pub fn _u8(&mut self, ti: &TypeInfo) -> DecodeResult<u8>[src]

pub fn u16(&mut self) -> DecodeResult<u16>[src]

pub fn _u16(&mut self, ti: &TypeInfo) -> DecodeResult<u16>[src]

pub fn u32(&mut self) -> DecodeResult<u32>[src]

pub fn _u32(&mut self, ti: &TypeInfo) -> DecodeResult<u32>[src]

pub fn u64(&mut self) -> DecodeResult<u64>[src]

pub fn _u64(&mut self, ti: &TypeInfo) -> DecodeResult<u64>[src]

pub fn i8(&mut self) -> DecodeResult<i8>[src]

pub fn _i8(&mut self, ti: &TypeInfo) -> DecodeResult<i8>[src]

pub fn i16(&mut self) -> DecodeResult<i16>[src]

pub fn _i16(&mut self, ti: &TypeInfo) -> DecodeResult<i16>[src]

pub fn i32(&mut self) -> DecodeResult<i32>[src]

pub fn _i32(&mut self, ti: &TypeInfo) -> DecodeResult<i32>[src]

pub fn i64(&mut self) -> DecodeResult<i64>[src]

pub fn _i64(&mut self, ti: &TypeInfo) -> DecodeResult<i64>[src]

pub fn int(&mut self) -> DecodeResult<Int>[src]

pub fn f16(&mut self) -> DecodeResult<f32>[src]

pub fn f32(&mut self) -> DecodeResult<f32>[src]

pub fn f64(&mut self) -> DecodeResult<f64>[src]

pub fn read_bytes(&mut self, b: &mut [u8]) -> DecodeResult<usize>[src]

Decode a single byte string into the given buffer.

The provided buffer must be large enough to hold the entire byte string, otherwise an error is returned.

Please note that indefinite byte strings are not supported by this method (Consider using Decoder::bytes_iter() for this use-case).

pub fn bytes(&mut self) -> DecodeResult<Vec<u8>>[src]

Decode a single byte string.

Please note that indefinite byte strings are not supported by this method (Consider using Decoder::bytes_iter() for this use-case).

pub fn bytes_iter(&mut self) -> DecodeResult<BytesIter<'_, R>>[src]

Decode an indefinite byte string.

pub fn text(&mut self) -> DecodeResult<String>[src]

Decode a single UTF-8 encoded String.

Please note that indefinite strings are not supported by this method (Consider using Decoder::text_iter() for this use-case).

pub fn _text(&mut self, ti: &TypeInfo) -> DecodeResult<String>[src]

pub fn text_iter(&mut self) -> DecodeResult<TextIter<'_, R>>[src]

Decode an indefinite string.

pub fn tag(&mut self) -> DecodeResult<Tag>[src]

Decode a Tag. If no tag is found an UnexpectedType error is returned.

pub fn array(&mut self) -> DecodeResult<usize>[src]

Decode the begin of an array. The length is returned unless it exceeds the configured maximum.

Please note that indefinite arrays are not supported by this method (Consider using Decoder::array_begin() for this use-case).

pub fn _array(&mut self, ti: &TypeInfo) -> DecodeResult<usize>[src]

pub fn array_begin(&mut self) -> DecodeResult<()>[src]

Decode the begin of an indefinite array. After this one can continue decoding items, but a Break value will be encountered at some unknown point.

(Consider using or_break around every decoding step within an indefinite array to handle this case).

pub fn object(&mut self) -> DecodeResult<usize>[src]

Decode the begin of an object. The size (number of key-value pairs) is returned unless it exceeds the configured maximum.

Please note that indefinite objects are not supported by this method (Consider using Decoder::object_begin for this use-case).

pub fn object_begin(&mut self) -> DecodeResult<()>[src]

Decode the begin of an indefinite object. After this one can continue decoding items, but a Break value will be encountered at some unknown point.

(Consider using or_break around every decoding step within an indefinite object to handle this case).

pub fn typeinfo(&mut self) -> DecodeResult<TypeInfo>[src]

pub fn typeinfo_and_tag(&mut self) -> DecodeResult<(TypeInfo, u64)>[src]

impl<R: ReadBytesExt + Skip> Decoder<R>[src]

pub fn skip(&mut self) -> DecodeResult<()>[src]

Skip over a single CBOR value.

Please note that this function does not validate the value hence it might not even be well-formed CBOR. Instead skip is an optimisation over GenericDecoder::value() and generally only determines as much information as necessary to safely skip a value without keeping all of it in memory.

impl<R: ReadBytesExt + ReadSlice> Decoder<R>[src]

pub fn text_borrow(&mut self) -> DecodeResult<&str>[src]

Decode a single UTF-8 encoded String and borrow it from underlying buffer instead of allocating.

Please note that indefinite strings are not supported by this method.

pub fn bytes_borrow(&mut self) -> DecodeResult<&[u8]>[src]

Decode a single byte string and borrow it from underlying buffer instead of allocating.

Please note that indefinite byte strings are not supported by this method.

Auto Trait Implementations

impl<R> RefUnwindSafe for Decoder<R> where
    R: RefUnwindSafe
[src]

impl<R> Send for Decoder<R> where
    R: Send
[src]

impl<R> Sync for Decoder<R> where
    R: Sync
[src]

impl<R> Unpin for Decoder<R> where
    R: Unpin
[src]

impl<R> UnwindSafe for Decoder<R> where
    R: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.