wpan/mac: use slice view to avoid copy

This commit is contained in:
xoviat
2023-07-16 12:41:57 -05:00
parent c7ec45a004
commit e95a7dc555
6 changed files with 77 additions and 63 deletions

View File

@ -85,12 +85,7 @@ impl Mac {
where
T: MacCommand,
{
let mut payload = [0u8; MAX_PACKET_SIZE];
cmd.copy_into_slice(&mut payload);
let response = self
.tl_write_and_get_response(T::OPCODE as u16, &payload[..T::SIZE])
.await;
let response = self.tl_write_and_get_response(T::OPCODE as u16, cmd.payload()).await;
if response == 0x00 {
Ok(())
@ -107,8 +102,6 @@ impl Mac {
}
}
const MAX_PACKET_SIZE: usize = 255;
impl evt::MemoryManager for Mac {
/// SAFETY: passing a pointer to something other than a managed event packet is UB
unsafe fn drop_event_packet(_: *mut EvtPacket) {