pub trait Codec<N: NestedValue> {
    // Required methods
    fn parse<'a, T: Parse<&'a Self, N>>(
        &'a self,
        value: &N
    ) -> Result<T, ParseError>;
    fn unparse<'a, T: Unparse<&'a Self, N>>(&'a self, value: &T) -> N;
}
Expand description

Every language implements Codec, which supplies convenient shorthand for invoking Parse::parse and Unparse::unparse.

Required Methods§

source

fn parse<'a, T: Parse<&'a Self, N>>( &'a self, value: &N ) -> Result<T, ParseError>

Delegates to T::parse, using self as language and the given value as input.

source

fn unparse<'a, T: Unparse<&'a Self, N>>(&'a self, value: &T) -> N

Delegates to value.unparse, using self as language.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<L, N: NestedValue> Codec<N> for L