pub struct CdcCommandPacket<const CMD: u8, P: Encode> { /* private fields */ }
Expand description
CDC (Simple) command packet.
A device-bound message containing a command identifier and an encoded payload.
Each packet begins with a 4-byte COMMAND_HEADER
, followed by the opcode,
and then an optional length-prefixed payload.
The payload type P
must implement Encode
.
§Encoding
Field | Size | Description |
---|---|---|
header | 4 | Must be COMMAND_HEADER . |
cmd | 1 | A CDC command opcode indicating the type of packet. |
size | 1–2 | Size of payload encoded as a VarU16 . |
payload | n | Encoded payload. |
Implementations§
Trait Implementations§
Source§impl<const CMD: u8, P: Clone + Encode> Clone for CdcCommandPacket<CMD, P>
impl<const CMD: u8, P: Clone + Encode> Clone for CdcCommandPacket<CMD, P>
Source§fn clone(&self) -> CdcCommandPacket<CMD, P>
fn clone(&self) -> CdcCommandPacket<CMD, P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<const CMD: u8, P: Copy + Encode> Copy for CdcCommandPacket<CMD, P>
impl<const CMD: u8, P: Eq + Encode> Eq for CdcCommandPacket<CMD, P>
impl<const CMD: u8, P: Encode> StructuralPartialEq for CdcCommandPacket<CMD, P>
Auto Trait Implementations§
impl<const CMD: u8, P> Freeze for CdcCommandPacket<CMD, P>where
P: Freeze,
impl<const CMD: u8, P> RefUnwindSafe for CdcCommandPacket<CMD, P>where
P: RefUnwindSafe,
impl<const CMD: u8, P> Send for CdcCommandPacket<CMD, P>where
P: Send,
impl<const CMD: u8, P> Sync for CdcCommandPacket<CMD, P>where
P: Sync,
impl<const CMD: u8, P> Unpin for CdcCommandPacket<CMD, P>where
P: Unpin,
impl<const CMD: u8, P> UnwindSafe for CdcCommandPacket<CMD, P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more