Codec

Trait Codec 

Source
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.

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.

Implementors§

Source§

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