#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct PacketPayload<'a> {
bytes: &'a [u8],
}
impl<'a> PacketPayload<'a> {
pub const EMPTY: Self = Self { bytes: &[] };
#[must_use]
pub const fn new(bytes: &'a [u8]) -> Self {
Self { bytes }
}
#[must_use]
pub const fn as_bytes(self) -> &'a [u8] {
self.bytes
}
#[must_use]
pub const fn len(self) -> usize {
self.bytes.len()
}
#[must_use]
pub const fn is_empty(self) -> bool {
self.bytes.is_empty()
}
}