diff --git a/examples/obsw-std/src/eps/pcdu.rs b/examples/obsw-std/src/eps/pcdu.rs index 135591b..df30b34 100644 --- a/examples/obsw-std/src/eps/pcdu.rs +++ b/examples/obsw-std/src/eps/pcdu.rs @@ -179,14 +179,7 @@ impl SerialInterface for SerialInterfaceDummy { let switch_map_mut = &mut self.switch_map.borrow_mut().0; match pcdu_req { PcduRequest::SwitchDevice { switch, state } => { - match switch_map_mut.entry(switch) { - std::collections::hash_map::Entry::Occupied(mut val) => { - *val.get_mut() = state; - } - std::collections::hash_map::Entry::Vacant(vacant) => { - vacant.insert(state); - } - }; + switch_map_mut.insert(switch, state); } PcduRequest::RequestSwitchInfo => { let mut reply_deque_mut = self.reply_deque.borrow_mut(); diff --git a/examples/obsw-std/src/interface/sim_client_udp.rs b/examples/obsw-std/src/interface/sim_client_udp.rs index 5b4ddbb..83c90e4 100644 --- a/examples/obsw-std/src/interface/sim_client_udp.rs +++ b/examples/obsw-std/src/interface/sim_client_udp.rs @@ -176,7 +176,6 @@ impl SimClientUdp { #[cfg(test)] pub mod tests { use std::{ - collections::HashMap, net::{SocketAddr, UdpSocket}, sync::{ Arc, @@ -191,6 +190,8 @@ pub mod tests { eps::{PcduReply, PcduRequest}, }; + use types::pcdu::SwitchMapBinary; + use super::SimClientUdp; struct UdpSimTestServer { @@ -369,7 +370,7 @@ pub mod tests { ); // We inject the reply ourselves. - let pcdu_reply = PcduReply::SwitchInfo(HashMap::new()); + let pcdu_reply = PcduReply::SwitchInfo(SwitchMapBinary::default()); server_sim_reply_tx .send(SimReply::from(pcdu_reply.clone())) .expect("sending PCDU reply failed"); diff --git a/examples/types/Cargo.toml b/examples/types/Cargo.toml index 1911db2..23535b6 100644 --- a/examples/types/Cargo.toml +++ b/examples/types/Cargo.toml @@ -4,12 +4,13 @@ version = "0.1.0" edition = "2024" [dependencies] -serde = { version = "1", features = ["derive"] } -spacepackets = { version = "0.18", default-features = false } -satrs = { path = "../../satrs", features = ["serde"] } -num_enum = { version = "0.7" } -strum = { version = "0.28", features = ["derive"] } -postcard = { version = "1" } -thiserror = { version = "2" } +serde = { version = "1", default-features = false, features = ["derive"] } +spacepackets = { version = "0.18", default-features = false, features = ["serde"] } +satrs = { path = "../../satrs", default-features = false, features = ["serde"] } +num_enum = { version = "0.7", default-features = false } +strum = { version = "0.28", default-features = false, features = ["derive"] } +postcard = { version = "1", features = ["alloc"] } +thiserror = { version = "2", default-features = false } bitbybit = "2" arbitrary-int = "2" +hashbrown = { version = "0.17", features = ["serde"] } diff --git a/examples/types/src/lib.rs b/examples/types/src/lib.rs index cd32071..f760178 100644 --- a/examples/types/src/lib.rs +++ b/examples/types/src/lib.rs @@ -1,3 +1,4 @@ +#![no_std] extern crate alloc; use core::str::FromStr; diff --git a/examples/types/src/pcdu.rs b/examples/types/src/pcdu.rs index 623774d..2299403 100644 --- a/examples/types/src/pcdu.rs +++ b/examples/types/src/pcdu.rs @@ -1,4 +1,4 @@ -use std::collections::HashMap; +use hashbrown::HashMap; use strum::IntoEnumIterator as _;