pub struct Kernel<R> { /* private fields */ }
Expand description
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.
Implementations§
Source§impl<R: ReadBytesExt> Kernel<R>
impl<R: ReadBytesExt> Kernel<R>
pub fn new(r: R) -> Kernel<R>
pub fn into_reader(self) -> R
pub fn typeinfo(&mut self) -> DecodeResult<TypeInfo>
pub fn simple(&mut self, ti: &TypeInfo) -> DecodeResult<Simple>
pub fn bool(&mut self, ti: &TypeInfo) -> DecodeResult<bool>
pub fn u8(&mut self, ti: &TypeInfo) -> DecodeResult<u8>
pub fn u16(&mut self, ti: &TypeInfo) -> DecodeResult<u16>
pub fn u32(&mut self, ti: &TypeInfo) -> DecodeResult<u32>
pub fn u64(&mut self, ti: &TypeInfo) -> DecodeResult<u64>
pub fn i8(&mut self, ti: &TypeInfo) -> DecodeResult<i8>
pub fn i16(&mut self, ti: &TypeInfo) -> DecodeResult<i16>
pub fn i32(&mut self, ti: &TypeInfo) -> DecodeResult<i32>
pub fn i64(&mut self, ti: &TypeInfo) -> DecodeResult<i64>
pub fn int(&mut self, ti: &TypeInfo) -> DecodeResult<Int>
pub fn f16(&mut self, ti: &TypeInfo) -> DecodeResult<f32>
pub fn f32(&mut self, ti: &TypeInfo) -> DecodeResult<f32>
pub fn f64(&mut self, ti: &TypeInfo) -> DecodeResult<f64>
Sourcepub fn unsigned(&mut self, first: u8) -> DecodeResult<u64>
pub fn unsigned(&mut self, first: u8) -> DecodeResult<u64>
Decode first
and potentially the following bytes as an
unsigned value following the rules of major type 0.
Sourcepub fn raw_data(&mut self, begin: u8, max_len: usize) -> DecodeResult<Vec<u8>>
pub fn raw_data(&mut self, begin: u8, max_len: usize) -> DecodeResult<Vec<u8>>
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.
Sourcepub fn read_raw_data(
&mut self,
begin: u8,
buf: &mut [u8],
) -> DecodeResult<usize>
pub fn read_raw_data( &mut self, begin: u8, buf: &mut [u8], ) -> DecodeResult<usize>
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.
Auto Trait Implementations§
impl<R> Freeze for Kernel<R>where
R: Freeze,
impl<R> RefUnwindSafe for Kernel<R>where
R: RefUnwindSafe,
impl<R> Send for Kernel<R>where
R: Send,
impl<R> Sync for Kernel<R>where
R: Sync,
impl<R> Unpin for Kernel<R>where
R: Unpin,
impl<R> UnwindSafe for Kernel<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more