ValueDecoder

Trait ValueDecoder 

Source
pub trait ValueDecoder {
    type Item;

    // Required method
    fn decode_directly<R: Read>(data: &mut R) -> Result<Self::Item>;

    // Provided methods
    fn check_key_on_position<K: Into<String>, R: Read>(
        data: &mut R,
        key: K,
    ) -> bool { ... }
    fn decode_for_key<K: Into<String>, R: Read>(
        data: &mut R,
        key: K,
    ) -> Result<Self::Item> { ... }
}
Expand description

decoder methods for values (and primitive types). This is an extension trait.

Required Associated Types§

Source

type Item

the return value for decode_directly() and decode_for_key();

Required Methods§

Source

fn decode_directly<R: Read>(data: &mut R) -> Result<Self::Item>

decodes the value directly.

Provided Methods§

Source

fn check_key_on_position<K: Into<String>, R: Read>(data: &mut R, key: K) -> bool

helper method to check, if the key is on position.

Source

fn decode_for_key<K: Into<String>, R: Read>( data: &mut R, key: K, ) -> Result<Self::Item>

decodes the value for the given key.

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.

Implementations on Foreign Types§

Source§

impl ValueDecoder for bool

Source§

impl ValueDecoder for f32

Source§

impl ValueDecoder for i64

Source§

impl ValueDecoder for str

Source§

impl ValueDecoder for u8

Source§

impl ValueDecoder for u16

Source§

impl ValueDecoder for u32

Source§

impl ValueDecoder for u64

Source§

impl ValueDecoder for String

Source§

impl ValueDecoder for Vec<u8>

Source§

impl ValueDecoder for Vec<u64>

Source§

impl<H> ValueDecoder for Vec<H>
where H: HeaderCoding<Item = H>,

Source§

impl<K, V> ValueDecoder for BTreeMap<K, V>
where K: ValueDecoder<Item = K> + Ord, V: ValueDecoder<Item = V>,

Source§

impl<K, V> ValueDecoder for HashMap<K, V>
where K: ValueDecoder<Item = K> + Eq + Hash, V: ValueDecoder<Item = V>,

Implementors§