pub(crate) const MAX_PAYLOAD_SIZE: usize = 4;
#[derive(Debug)]
pub struct Packet {
pub(crate) header: u8,
pub(crate) kind: Kind,
}
impl Packet {
pub fn header(&self) -> u8 {
self.header
}
pub fn kind(&self) -> &Kind {
&self.kind
}
}
#[derive(Debug)]
pub enum Kind {
Instrumentation(Instrumentation),
#[doc(hidden)]
_NoExhaustiveMatch,
}
#[derive(Debug)]
pub struct Instrumentation {
pub(crate) payload: [u8; MAX_PAYLOAD_SIZE],
pub(crate) payload_len: usize,
pub(crate) port: u8,
}
impl Instrumentation {
pub fn payload(&self) -> &[u8] {
&self.payload[0..self.payload_len]
}
pub fn port(&self) -> u8 {
self.port
}
}