Trait ESExprVarArgCodec

Source
pub trait ESExprVarArgCodec<'a>:
    ESExprEncodedEq
    + Sized
    + 'a {
    type Element: ESExprCodec<'a> + 'a;

    // Required methods
    fn encode_vararg_element(&'a self, args: &mut Vec<ESExpr<'a>>);
    fn decode_vararg_element(
        args: &mut VecDeque<ESExpr<'a>>,
        constructor_name: &str,
        start_index: &mut usize,
    ) -> Result<Self, DecodeError>;
}
Expand description

A field codec for variable arguments.

Required Associated Types§

Source

type Element: ESExprCodec<'a> + 'a

The element type.

Required Methods§

Source

fn encode_vararg_element(&'a self, args: &mut Vec<ESExpr<'a>>)

Encode variable arguments

Source

fn decode_vararg_element( args: &mut VecDeque<ESExpr<'a>>, constructor_name: &str, start_index: &mut usize, ) -> Result<Self, DecodeError>

Decode variable 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>> ESExprVarArgCodec<'a> for Vec<A>

Source§

type Element = A

Source§

fn encode_vararg_element(&'a self, args: &mut Vec<ESExpr<'a>>)

Source§

fn decode_vararg_element( args: &mut VecDeque<ESExpr<'a>>, constructor_name: &str, start_index: &mut usize, ) -> Result<Self, DecodeError>

Source§

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

Source§

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

Source§

fn encode_vararg_element(&'a self, args: &mut Vec<ESExpr<'a>>)

Source§

fn decode_vararg_element( args: &mut VecDeque<ESExpr<'a>>, constructor_name: &str, start_index: &mut usize, ) -> Result<Self, DecodeError>

Implementors§