diff --git a/wicked-waifus-protocol/src/message.rs b/wicked-waifus-protocol/src/message.rs index 87fd3c6..b297477 100644 --- a/wicked-waifus-protocol/src/message.rs +++ b/wicked-waifus-protocol/src/message.rs @@ -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 {