Added possibility to take box as ref for debug logging

This commit is contained in:
xavo95 2025-03-08 16:52:31 +01:00
parent 3537e46be1
commit 1c951fe392
Signed by: xavo95
GPG key ID: CBF8ADED6DEBB783

View file

@ -173,6 +173,14 @@ impl Message {
| Self::Push { payload, .. } => payload.take().unwrap_or_else(|| Box::new([0u8; 0])),
}
}
pub fn get_payload(&mut self) -> Option<&Box<[u8]>> {
match self {
Self::Request { payload, .. }
| Self::Response { payload, .. }
| Self::Push { payload, .. } => payload.as_ref(),
}
}
pub fn set_payload(&mut self, new_payload: Box<[u8]>) {
match self {