x11_input_mirror/utils.rs
1use std::process::Command;
2
3pub fn encode_u16(num: u16) -> [u8; 2] {
4 num.to_le_bytes()
5}
6
7pub fn decode_u16(bytes: &[u8]) -> String {
8 let mut buf = [0u8; 2];
9 buf[0..2].copy_from_slice(bytes);
10 u16::from_le_bytes(buf).to_string()
11}
12
13pub fn need_dep(name: &str) {
14 Command::new(name)
15 .arg("--version")
16 .output()
17 .unwrap_or_else(|_| panic!("Missing global binary: {}", name));
18}