sakka 0.0.21

A low-level framework for implementing binary file format parsers and writers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::{Error, Reader, Writer};

pub trait Codec<T, Ctx = ()>
where
    Self::Error: From<Error>,
{
    type Error;

    fn encode(value: &T, writer: &mut Writer<Ctx>) -> Result<(), Self::Error>;

    fn decode(reader: &mut Reader<'_, Ctx>) -> Result<T, Self::Error>;
}