Struct cbor::DirectDecoder[][src]

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

Experimental and incomplete direct decoder.

WARNING: Do not use this to decode CBOR data that you don't control. It is currently subject to an attack vector that permits an attacker to cause your process to abort due to an out-of-memory error. See: https://github.com/rust-lang/rustc-serialize/issues/115 (The normal decoder in this crate is not subject to this problem.)

A "direct" decoder is one that does not use an intermediate abstact syntax representation. Namely, the bytes are decoded directly into types. This significantly impacts performance. For example, it doesn't have to box and unbox every data item.

However, implementing a direct decoder is much harder in the existing serialization infrastructure. Currently, structs and enums are not implemented. (But Vecs, tuples, Options and maps should work.)

Methods

impl CborDecoder<Cursor<Vec<u8>>>
[src]

Create a new CBOR decoder that reads from the buffer given.

The buffer is usually given as either a Vec<u8> or a &[u8].

impl<R: Read> CborDecoder<BufReader<R>>
[src]

Create a new CBOR decoder that reads from the reader given.

Trait Implementations

impl<R: Read> RustcDecoder for CborDecoder<R>
[src]

The error type for method results.

Record a decoding error. Read more

Read a nil value.

Read a usize value.

Read a u64 value.

Read a u32 value.

Read a u16 value.

Read a u8 value.

Read a isize value.

Read a i64 value.

Read a i32 value.

Read a i16 value.

Read a i8 value.

Read a bool value.

Read a f64 value.

Read a f32 value.

Read a char value.

Read a string value.

Read an enumeration value. Read more

Read an enumeration value. Read more

Read an unnamed data item for an enumeration variant. Read more

Read an enumeration value. Read more

Read a named data item for an enumeration variant. Read more

Read an struct value. Read more

Read a field for a struct value. Read more

Read a tuple value. Read more

Read a data item for a tuple. Read more

Read a tuple struct value. Read more

Read a data item for a tuple struct. Read more

Read an optional value. Read more

Read a sequence of values. Read more

Read an element in the sequence. Read more

Read an associative container (map). Read more

Read the key for an entry in a map. Read more

Read the value for an entry in a map. Read more

Auto Trait Implementations

impl<R> Send for DirectDecoder<R> where
    R: Send

impl<R> Sync for DirectDecoder<R> where
    R: Sync