Expand description
Serialize the given message as a byte vector.
Example
use sbp::messages::logging::MsgLog;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let text = String::from("hello");
let msg = MsgLog {
sender_id: Some(1),
level: 1,
text: text.clone().into(),
};
let bytes = sbp::to_vec(&msg)?;
assert_eq!(
&bytes[sbp::HEADER_LEN + 1..bytes.len() - sbp::CRC_LEN],
text.as_bytes()
);
Ok(())
}