1 2 3 4 5 6 7 8 9 10 11 12 13
use std::borrow::Cow; pub trait BytesEncode<'a> { type EItem: ?Sized + 'a; fn bytes_encode(item: &'a Self::EItem) -> Option<Cow<'a, [u8]>>; } pub trait BytesDecode<'a> { type DItem: 'a; fn bytes_decode(bytes: &'a [u8]) -> Option<Self::DItem>; }