Trait Serializer

Source
pub trait Serializer {
    type Error;

    // Required methods
    fn name() -> &'static str;
    fn version() -> i32;
    fn serialize(
        buffer: &mut impl Write,
        header: &Header,
        root: &Element,
    ) -> Result<(), Self::Error>;
    fn deserialize(
        buffer: &mut impl BufRead,
        encoding: String,
        version: i32,
    ) -> Result<Element, Self::Error>;
}
Expand description

A trait for serializing and deserializing elements.

Required Associated Types§

Required Methods§

Source

fn name() -> &'static str

Returns the name of the serializer.

Source

fn version() -> i32

Returns the current version of the serializer.

Source

fn serialize( buffer: &mut impl Write, header: &Header, root: &Element, ) -> Result<(), Self::Error>

Source

fn deserialize( buffer: &mut impl BufRead, encoding: String, version: i32, ) -> Result<Element, Self::Error>

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§