Decode a zerompk byte buffer into a `SwimMessage`. Truncated or malformed input returns [`SwimError::Decode`] rather than panicking.
(bytes: &[u8])
| 24 | /// Decode a zerompk byte buffer into a `SwimMessage`. Truncated or |
| 25 | /// malformed input returns [`SwimError::Decode`] rather than panicking. |
| 26 | pub fn decode(bytes: &[u8]) -> Result<SwimMessage, SwimError> { |
| 27 | zerompk::from_msgpack(bytes).map_err(|e| SwimError::Decode { |
| 28 | detail: e.to_string(), |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | #[cfg(test)] |
| 33 | mod tests { |
no test coverage detected