Struct cbor::DirectDecoder
[−]
[src]
pub struct DirectDecoder<R> {
// some 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]
fn from_bytes<'a, T>(bytes: T) -> CborDecoder<Cursor<Vec<u8>>> where T: Into<Vec<u8>>
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]
fn from_reader(rdr: R) -> CborDecoder<BufReader<R>>
Create a new CBOR decoder that reads from the reader given.