Skip to main content

build

Function build 

Source
pub fn build(cmd: &[u8], out: &mut [u8]) -> Option<usize>
Expand description

Build the full wire packet from raw command bytes: command + checksum, written into out. Returns the total bytes written, or None if out is too small (cmd.len() + 2 needed).

use skydroid_protocol::packet::build;
let mut out = [0u8; 32];
let n = build(b"#TPUD2wCAP01", &mut out).unwrap();
assert_eq!(n, 14);
assert_eq!(&out[..12], b"#TPUD2wCAP01");