Trait serde_tagged::de::SeedFactory

source ·
pub trait SeedFactory<'de, T> {
    type Value;
    type Seed: DeserializeSeed<'de, Value = Self::Value>;

    // Required method
    fn seed<E>(self, tag: T) -> Result<Self::Seed, E>
       where E: Error;
}
Expand description

A factory that creates a DeserializeSeed implementation based on a given tag.

Convenience implementations of this trait are provided for the standard map types with &'static str and String as key, as well as WithoutTag and WithTag.

Required Associated Types§

source

type Value

The type of the value that will be produced by the DeserializeSeed implementation.

source

type Seed: DeserializeSeed<'de, Value = Self::Value>

The type of the DeserializeSeed implementation that will be returned by this factory.

Required Methods§

source

fn seed<E>(self, tag: T) -> Result<Self::Seed, E>
where E: Error,

Returns the seed that should be used to deserialize a value tagged with the given tag.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'de, T, V> SeedFactory<'de, T> for PhantomData<V>
where V: Deserialize<'de>,

§

type Value = V

§

type Seed = PhantomData<V>

source§

fn seed<E>(self, _tag: T) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'de, V, S> SeedFactory<'de, TagString<'de>> for BTreeMap<&'static str, S>
where S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'de, V, S> SeedFactory<'de, TagString<'de>> for BTreeMap<String, S>
where S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'de, V, S, H> SeedFactory<'de, TagString<'de>> for HashMap<&'static str, S, H>
where S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'de, V, S, H> SeedFactory<'de, TagString<'de>> for HashMap<String, S, H>
where S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S> SeedFactory<'de, TagString<'de>> for &'r BTreeMap<&'static str, S>
where &'r S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = &'r S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S> SeedFactory<'de, TagString<'de>> for &'r BTreeMap<String, S>
where &'r S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = &'r S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S> SeedFactory<'de, TagString<'de>> for &'r mut BTreeMap<&'static str, S>
where &'r mut S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = &'r mut S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S> SeedFactory<'de, TagString<'de>> for &'r mut BTreeMap<String, S>
where &'r mut S: DeserializeSeed<'de, Value = V>,

§

type Value = V

§

type Seed = &'r mut S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S, H> SeedFactory<'de, TagString<'de>> for &'r HashMap<&'static str, S, H>
where &'r S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = &'r S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S, H> SeedFactory<'de, TagString<'de>> for &'r HashMap<String, S, H>
where &'r S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = &'r S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S, H> SeedFactory<'de, TagString<'de>> for &'r mut HashMap<&'static str, S, H>
where &'r mut S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = &'r mut S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

source§

impl<'r, 'de, V, S, H> SeedFactory<'de, TagString<'de>> for &'r mut HashMap<String, S, H>
where &'r mut S: DeserializeSeed<'de, Value = V>, H: BuildHasher,

§

type Value = V

§

type Seed = &'r mut S

source§

fn seed<E>(self, tag: TagString<'de>) -> Result<Self::Seed, E>
where E: Error,

Implementors§

source§

impl<'de, T, V> SeedFactory<'de, T> for WithoutTag<V>
where V: Deserialize<'de>,

§

type Value = V

§

type Seed = PhantomData<V>

source§

impl<'de, V, T> SeedFactory<'de, T> for WithTag<V>
where V: Deserialize<'de>,