use std::fmt::{Debug, Display};
use bytes::{Bytes, BytesMut};
pub trait IsHeader {
type Error: Debug + Display;
#[must_use]
fn new(msg_len: u64) -> Self
where
Self: Sized;
#[must_use]
fn blank() -> Self
where
Self: Sized,
{
Self::new(0)
}
#[must_use]
fn size(&self) -> u64;
#[must_use]
fn as_bytes(&self) -> Bytes;
#[must_use]
fn as_bytes_mut(&self) -> BytesMut;
fn from_bytes(bytes: Bytes) -> Result<Self, Self::Error>
where
Self: Sized;
#[must_use]
fn header_size() -> usize;
}