blob: 03cdf15fee41df8508bf4e2d6737071d7c5719b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
pub trait Codec {
type Carrier;
type Payload;
type Output;
type Error;
fn encode(
&self,
carrier: impl Into<Self::Carrier>,
payload: impl Into<Self::Payload>,
) -> Result<Self::Output, Self::Error>;
fn decode(&self, encoded: impl Into<Self::Output>) -> Result<(Self::Carrier, Self::Payload), Self::Error>;
}
|