use at4_protocol::messaging; use messaging::ReceivableMessage; fn main() { let bytes = [ 0x55, 0x55, 0xb0, 0x80, 0x01, 0x2d, 0x00, 0x10, 0x40, 0x42, 0x1a, 0x00, 0x61, 0x80, 0x00, 0x00, 0x01, 0x00, 0x1a, 0x00, 0x61, 0x80, 0xff, 0xfe, 0xca, 0xcb, ]; let m = messaging::parse_message(&bytes); match m { Ok(m) => match m { ReceivableMessage::GroupStatuses(m) => { // Do whatever } ReceivableMessage::ACStatuses(m) => { // Some other function } }, Err(e) => panic!("{}", e), } }