Strategy messaging

This commit is contained in:
2026-07-25 19:23:04 +02:00
parent 7e79390052
commit 90876c83a7
2 changed files with 90 additions and 1 deletions
+18
View File
@@ -52,6 +52,24 @@ impl<T: PulseWire> PulseWire for Vec<T> {
}
}
impl<T: PulseWire> PulseWire for Option<T> {
fn to_com(&self) -> Vec<u8> {
if let Some(v) = self {
v.to_com()
} else {
vec![0]
}
}
fn from_com(com: &mut Vec<u8>) -> Self {
if com[0] > 0 {
Some(T::from_com(com))
} else {
None
}
}
}
impl PulseWire for String {
fn to_com(&self) -> Vec<u8> {
let bytes = self.as_bytes();