Struct probor::_cbor::decoder::Kernel
[−]
[src]
pub struct Kernel<R> { /* fields omitted */ }
This decoding kernel reads from an underlying std::io::Read
type
primitive CBOR values such as unsigned and signed integers as well
as raw bytes.
It forms the basis on which Decoder
and GenericDecoder
add logic
for handling Tag
s, heterogenous data and generic value decoding.
Methods
impl<R> Kernel<R> where
R: ReadBytesExt,
[src]
R: ReadBytesExt,
pub fn new(r: R) -> Kernel<R>
[src]
pub fn into_reader(self) -> R
[src]
pub fn typeinfo(&mut self) -> Result<(Type, u8), DecodeError>
[src]
pub fn simple(&mut self, ti: &(Type, u8)) -> Result<Simple, DecodeError>
[src]
pub fn bool(&mut self, ti: &(Type, u8)) -> Result<bool, DecodeError>
[src]
pub fn u8(&mut self, ti: &(Type, u8)) -> Result<u8, DecodeError>
[src]
pub fn u16(&mut self, ti: &(Type, u8)) -> Result<u16, DecodeError>
[src]
pub fn u32(&mut self, ti: &(Type, u8)) -> Result<u32, DecodeError>
[src]
pub fn u64(&mut self, ti: &(Type, u8)) -> Result<u64, DecodeError>
[src]
pub fn i8(&mut self, ti: &(Type, u8)) -> Result<i8, DecodeError>
[src]
pub fn i16(&mut self, ti: &(Type, u8)) -> Result<i16, DecodeError>
[src]
pub fn i32(&mut self, ti: &(Type, u8)) -> Result<i32, DecodeError>
[src]
pub fn i64(&mut self, ti: &(Type, u8)) -> Result<i64, DecodeError>
[src]
pub fn int(&mut self, ti: &(Type, u8)) -> Result<Int, DecodeError>
[src]
pub fn f16(&mut self, ti: &(Type, u8)) -> Result<f32, DecodeError>
[src]
pub fn f32(&mut self, ti: &(Type, u8)) -> Result<f32, DecodeError>
[src]
pub fn f64(&mut self, ti: &(Type, u8)) -> Result<f64, DecodeError>
[src]
pub fn unsigned(&mut self, first: u8) -> Result<u64, DecodeError>
[src]
Decode first
and potentially the following bytes as an
unsigned value following the rules of major type 0.
pub fn raw_data(
&mut self,
begin: u8,
max_len: usize
) -> Result<Vec<u8>, DecodeError>
[src]
&mut self,
begin: u8,
max_len: usize
) -> Result<Vec<u8>, DecodeError>
Read begin
as the length and return that many raw bytes.
If length is greater than the given max_len
, DecodeError::TooLong
is returned instead.
pub fn read_raw_data(
&mut self,
begin: u8,
buf: &mut [u8]
) -> Result<usize, DecodeError>
[src]
&mut self,
begin: u8,
buf: &mut [u8]
) -> Result<usize, DecodeError>
Read begin
as the length and read that many raw bytes into buf
.
If length is greater than the given buffer, DecodeError::TooLong
is returned instead.
impl<R> Kernel<R> where
R: ReadSlice + ReadBytesExt,
[src]
R: ReadSlice + ReadBytesExt,
pub fn raw_slice(
&mut self,
begin: u8,
max_len: usize
) -> Result<&[u8], DecodeError>
[src]
&mut self,
begin: u8,
max_len: usize
) -> Result<&[u8], DecodeError>
Read begin
as the length and return that many raw bytes as a slice.
If length is greater than the given max_len
, DecodeError::TooLong
is returned instead.