1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//! Byte-level input/output. pub mod adapters; use bytes::{Buf, BufMut}; use crate::protocol::Error; pub trait Encode { /// Encode self into the byte buffer. fn encode_into(&self, buf: &mut (impl BufMut + ?Sized)); } pub trait Decode: Sized { /// Decode [`Self`] from the byte buffer. fn decode_from(buf: &mut (impl Buf + ?Sized)) -> Result<Self, Error>; }