Struct cbor::decoder::Decoder
[−]
[src]
pub struct Decoder<R> { /* fields omitted */ }
The actual decoder type definition
Methods
impl<R: ReadBytesExt> Decoder<R>
[src]
fn new(c: Config, r: R) -> Decoder<R>
fn into_reader(self) -> R
fn kernel(&mut self) -> &mut Kernel<R>
fn simple(&mut self) -> DecodeResult<Simple>
fn bool(&mut self) -> DecodeResult<bool>
fn u8(&mut self) -> DecodeResult<u8>
fn u16(&mut self) -> DecodeResult<u16>
fn u32(&mut self) -> DecodeResult<u32>
fn u64(&mut self) -> DecodeResult<u64>
fn i8(&mut self) -> DecodeResult<i8>
fn i16(&mut self) -> DecodeResult<i16>
fn i32(&mut self) -> DecodeResult<i32>
fn i64(&mut self) -> DecodeResult<i64>
fn int(&mut self) -> DecodeResult<Int>
fn f16(&mut self) -> DecodeResult<f32>
fn f32(&mut self) -> DecodeResult<f32>
fn f64(&mut self) -> DecodeResult<f64>
fn bytes(&mut self) -> DecodeResult<Vec<u8>>
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).
fn bytes_iter(&mut self) -> DecodeResult<BytesIter<R>>
Decode an indefinite byte string.
fn text(&mut self) -> DecodeResult<String>
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).
fn text_iter(&mut self) -> DecodeResult<TextIter<R>>
Decode an indefinite string.
fn tag(&mut self) -> DecodeResult<Tag>
Decode a Tag
.
If no tag is found an UnexpectedType
error is returned.
fn array(&mut self) -> DecodeResult<usize>
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).
fn array_begin(&mut self) -> DecodeResult<()>
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).
fn object(&mut self) -> DecodeResult<usize>
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).
fn object_begin(&mut self) -> DecodeResult<()>
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).
impl<R: ReadBytesExt + Skip> Decoder<R>
[src]
fn skip(&mut self) -> DecodeResult<()>
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]
fn text_borrow(&mut self) -> DecodeResult<&str>
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.
fn bytes_borrow(&mut self) -> DecodeResult<&[u8]>
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.