CborMapDecoder

Trait CborMapDecoder 

Source
pub trait CborMapDecoder {
    // Required methods
    fn size(&self) -> Option<usize>;
    fn deserialize_key<K>(
        &mut self,
    ) -> Result<Option<K>, CborSerializationError>
       where K: CborDeserialize;
    fn deserialize_value<V>(&mut self) -> Result<V, CborSerializationError>
       where V: CborDeserialize;
    fn skip_value(&mut self) -> Result<(), CborSerializationError>;

    // Provided method
    fn deserialize_entry<K, V>(
        &mut self,
    ) -> Result<Option<(K, V)>, CborSerializationError>
       where K: CborDeserialize,
             V: CborDeserialize { ... }
}
Expand description

Decoder of CBOR map

Required Methods§

Source

fn size(&self) -> Option<usize>

Number of entries of the map being decoded (total number of entries, not remaining). Returns None if the map has indefinite size.

Source

fn deserialize_key<K>(&mut self) -> Result<Option<K>, CborSerializationError>
where K: CborDeserialize,

Deserialize an entry key. Returns None if all entries in the map has been deserialized.

Source

fn deserialize_value<V>(&mut self) -> Result<V, CborSerializationError>
where V: CborDeserialize,

Deserialize an entry value.

Source

fn skip_value(&mut self) -> Result<(), CborSerializationError>

Skips entry value

Provided Methods§

Source

fn deserialize_entry<K, V>( &mut self, ) -> Result<Option<(K, V)>, CborSerializationError>

Deserialize an entry consisting of a key and value. Returns None if all entries in the map has been deserialized. The total number of entries that can be deserialized is equal to Self::size.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R> CborMapDecoder for MapDecoder<'_, R>
where R: Read, <R as Read>::Error: Display,