Trait ESExprDictCodec

Source
pub trait ESExprDictCodec<'a>
where Self: Sized + 'a,
{ type Element: ESExprCodec<'a> + 'a; // Required methods fn encode_dict_element( &'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, ); fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>; }
Expand description

A field codec for dictionary arguments.

Required Associated Types§

Source

type Element: ESExprCodec<'a> + 'a

The element type.

Required Methods§

Source

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Encode dictionary arguments.

Source

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Decode dictionary arguments.

§Errors

Will return Err if decoding fails.

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<'a, A: ESExprCodec<'a>> ESExprDictCodec<'a> for BTreeMap<Cow<'a, str>, A>

Source§

type Element = A

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Source§

impl<'a, A: ESExprCodec<'a>> ESExprDictCodec<'a> for BTreeMap<String, A>

Source§

type Element = A

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Source§

impl<'a, A: ESExprCodec<'a>, S: BuildHasher + Default + 'static> ESExprDictCodec<'a> for HashMap<CowStr<'a>, A, S>

Source§

type Element = A

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Source§

impl<'a, A: ESExprCodec<'a>, S: BuildHasher + Default + 'static> ESExprDictCodec<'a> for HashMap<Cow<'a, str>, A, S>

Source§

type Element = A

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Source§

impl<'a, A: ESExprCodec<'a>, S: BuildHasher + Default + 'static> ESExprDictCodec<'a> for HashMap<String, A, S>

Source§

type Element = A

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Source§

impl<'a, F: ESExprDictCodec<'a>> ESExprDictCodec<'a> for Box<F>

Source§

type Element = <F as ESExprDictCodec<'a>>::Element

Source§

fn encode_dict_element(&'a self, kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>)

Source§

fn decode_dict_element( kwargs: &mut BTreeMap<CowStr<'a>, ESExpr<'a>>, constructor_name: &str, ) -> Result<Self, DecodeError>

Implementors§