miniconf

Trait TreeDeserialize

source
pub trait TreeDeserialize<'de> {
    // Required method
    fn deserialize_by_key<K, D>(
        &mut self,
        keys: K,
        de: D,
    ) -> Result<usize, Error<D::Error>>
       where K: Keys,
             D: Deserializer<'de>;
}
Expand description

Deserialize a leaf node by its keys.

See also crate::json or crate::postcard for convenient wrappers using this trait.

§Derive macro

See crate::TreeDeserialize. The derive macro attributes are described in the TreeKey trait.

Required Methods§

source

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

Deserialize a leaf node by its keys.

use miniconf::{IntoKeys, Leaf, TreeDeserialize, TreeKey};
#[derive(Default, TreeKey, TreeDeserialize)]
struct S {
    foo: Leaf<u32>,
    bar: [Leaf<u16>; 2],
};
let mut s = S::default();
let mut de = serde_json::de::Deserializer::from_slice(b"7");
s.deserialize_by_key(["bar", "0"].into_keys(), &mut de)
    .unwrap();
de.end().unwrap();
assert_eq!(*s.bar[0], 7);
§Args
  • keys: A Keys identifying the node.
  • de: A Deserializer to deserialize the value.
§Returns

Node depth on success

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'de, T0: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0,)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>, T3: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2, T3)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>, T3: TreeDeserialize<'de>, T4: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2, T3, T4)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>, T3: TreeDeserialize<'de>, T4: TreeDeserialize<'de>, T5: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2, T3, T4, T5)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>, T3: TreeDeserialize<'de>, T4: TreeDeserialize<'de>, T5: TreeDeserialize<'de>, T6: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2, T3, T4, T5, T6)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T0: TreeDeserialize<'de>, T1: TreeDeserialize<'de>, T2: TreeDeserialize<'de>, T3: TreeDeserialize<'de>, T4: TreeDeserialize<'de>, T5: TreeDeserialize<'de>, T6: TreeDeserialize<'de>, T7: TreeDeserialize<'de>> TreeDeserialize<'de> for (T0, T1, T2, T3, T4, T5, T6, T7)

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for &RefCell<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for Bound<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for Option<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for &mut T

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for Cell<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for RefCell<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for Range<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for RangeFrom<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>> TreeDeserialize<'de> for RangeTo<T>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>, E: TreeDeserialize<'de>> TreeDeserialize<'de> for Result<T, E>

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

source§

impl<'de, T: TreeDeserialize<'de>, const N: usize> TreeDeserialize<'de> for [T; N]

source§

fn deserialize_by_key<K, D>( &mut self, keys: K, de: D, ) -> Result<usize, Error<D::Error>>
where K: Keys, D: Deserializer<'de>,

Implementors§

source§

impl<'de, T: TryFrom<&'de str>> TreeDeserialize<'de> for StrLeaf<T>

source§

impl<'de, T: Deserialize<'de>> TreeDeserialize<'de> for Leaf<T>

source§

impl<'de, T: ?Sized> TreeDeserialize<'de> for Deny<T>