pub trait CborDecoder {
type MapDecoder: CborMapDecoder;
type ArrayDecoder: CborArrayDecoder;
Show 16 methods
// Required methods
fn decode_tag(&mut self) -> CborSerializationResult<u64>;
fn decode_positive(self) -> CborSerializationResult<u64>;
fn decode_negative(self) -> CborSerializationResult<u64>;
fn decode_map(self) -> CborSerializationResult<Self::MapDecoder>;
fn decode_array(self) -> CborSerializationResult<Self::ArrayDecoder>;
fn decode_bytes(self) -> CborSerializationResult<Vec<u8>>;
fn decode_bytes_exact(
self,
destination: &mut [u8],
) -> CborSerializationResult<()>;
fn decode_text(self) -> CborSerializationResult<Vec<u8>>;
fn decode_simple(self) -> CborSerializationResult<u8>;
fn decode_float(self) -> CborSerializationResult<f64>;
fn peek_data_item_header(
&mut self,
) -> CborSerializationResult<DataItemHeader>;
fn skip_data_item(self) -> CborSerializationResult<()>;
fn options(&self) -> SerializationOptions;
// Provided methods
fn decode_tag_expect(
&mut self,
expected_tag: u64,
) -> CborSerializationResult<()> { ... }
fn decode_map_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::MapDecoder>
where Self: Sized { ... }
fn decode_array_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::ArrayDecoder>
where Self: Sized { ... }
}Expand description
Decoder of CBOR. See https://www.rfc-editor.org/rfc/rfc8949.html#section-3
Required Associated Types§
Sourcetype MapDecoder: CborMapDecoder
type MapDecoder: CborMapDecoder
Associated map decoder
Sourcetype ArrayDecoder: CborArrayDecoder
type ArrayDecoder: CborArrayDecoder
Associated array decoder
Required Methods§
Sourcefn decode_tag(&mut self) -> CborSerializationResult<u64>
fn decode_tag(&mut self) -> CborSerializationResult<u64>
Decode tag data item
Sourcefn decode_positive(self) -> CborSerializationResult<u64>
fn decode_positive(self) -> CborSerializationResult<u64>
Decode positive integer data item
Sourcefn decode_negative(self) -> CborSerializationResult<u64>
fn decode_negative(self) -> CborSerializationResult<u64>
Decode negative integer data item. Notice that the
value of the data item is -(negative + 1) where
negative is the returned value.
Sourcefn decode_map(self) -> CborSerializationResult<Self::MapDecoder>
fn decode_map(self) -> CborSerializationResult<Self::MapDecoder>
Decode map. Returns a map decoder that must be used to decode the map.
Sourcefn decode_array(self) -> CborSerializationResult<Self::ArrayDecoder>
fn decode_array(self) -> CborSerializationResult<Self::ArrayDecoder>
Decode array. Returns an array decoder that must be used to decode the array.
Sourcefn decode_bytes(self) -> CborSerializationResult<Vec<u8>>
fn decode_bytes(self) -> CborSerializationResult<Vec<u8>>
Decode bytes.
Sourcefn decode_bytes_exact(
self,
destination: &mut [u8],
) -> CborSerializationResult<()>
fn decode_bytes_exact( self, destination: &mut [u8], ) -> CborSerializationResult<()>
Decode bytes into given destination. The length of the bytes data item
must match the destination length, else an error is returned.
Sourcefn decode_text(self) -> CborSerializationResult<Vec<u8>>
fn decode_text(self) -> CborSerializationResult<Vec<u8>>
Decode text and return UTF8 encoding.
Sourcefn decode_simple(self) -> CborSerializationResult<u8>
fn decode_simple(self) -> CborSerializationResult<u8>
Decode simple value, see https://www.rfc-editor.org/rfc/rfc8949.html#name-floating-point-numbers-and-
Sourcefn decode_float(self) -> CborSerializationResult<f64>
fn decode_float(self) -> CborSerializationResult<f64>
Sourcefn peek_data_item_header(&mut self) -> CborSerializationResult<DataItemHeader>
fn peek_data_item_header(&mut self) -> CborSerializationResult<DataItemHeader>
Peeks header of next data item to be decoded.
Sourcefn skip_data_item(self) -> CborSerializationResult<()>
fn skip_data_item(self) -> CborSerializationResult<()>
Skips next header and potential content for the data item
Sourcefn options(&self) -> SerializationOptions
fn options(&self) -> SerializationOptions
Serialization options in current context
Provided Methods§
Sourcefn decode_tag_expect(
&mut self,
expected_tag: u64,
) -> CborSerializationResult<()>
fn decode_tag_expect( &mut self, expected_tag: u64, ) -> CborSerializationResult<()>
Decode that and check it equals the given expected_tag
Sourcefn decode_map_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::MapDecoder>where
Self: Sized,
fn decode_map_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::MapDecoder>where
Self: Sized,
Decode map and check number of entries equals expected_size
Sourcefn decode_array_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::ArrayDecoder>where
Self: Sized,
fn decode_array_expect_size(
self,
expected_size: usize,
) -> CborSerializationResult<Self::ArrayDecoder>where
Self: Sized,
Decode array and check number of elements equals expected_size