Trait Codec

Source
pub trait Codec {
    type EncodeError: Error + Send + Sync + 'static;
    type DecodeError: Error + Send + Sync + 'static;

    const EXTENSION: &'static str;

    // Required methods
    fn encode(
        writer: impl Write,
        profile: &Profile<'_>,
    ) -> Result<(), Self::EncodeError>;
    fn decode(slice: &[u8]) -> Result<Profile<'_>, Self::DecodeError>;
}
Expand description

A codec for encoding and decoding profiles.

Required Associated Constants§

Source

const EXTENSION: &'static str

The file extension for this codec.

Required Associated Types§

Source

type EncodeError: Error + Send + Sync + 'static

The error type for encoding.

Source

type DecodeError: Error + Send + Sync + 'static

The error type for decoding.

Required Methods§

Source

fn encode( writer: impl Write, profile: &Profile<'_>, ) -> Result<(), Self::EncodeError>

Encodes a profile into the given writer.

Source

fn decode(slice: &[u8]) -> Result<Profile<'_>, Self::DecodeError>

Decodes a profile from the given slice.

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§