Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
//! Protocol codec

use std::io;

use serde::de::DeserializeOwned;

use crate::framing::Framing;

pub trait Codec: Framing {
    fn encode<T: serde::Serialize>(msg: &T) -> io::Result<Self::Buf>;
    fn decode<T: DeserializeOwned>(buf: &mut Self::Buf) -> io::Result<T>;
}