pub struct CdcReplyPacket<const CMD: u8, P: Decode> {
pub size: u16,
pub payload: P,
}
Expand description
CDC (Simple) reply packet.
A host-bound packet sent in response to a CdcCommandPacket
.
Each reply consists of a 2-byte REPLY_HEADER
, the echoed command ID,
a variable-width length field, and the decoded payload.
The payload type P
must implement Decode
.
§Encoding
Field | Size | Description |
---|---|---|
header | 2 | Must be REPLY_HEADER . |
cmd | 1 | A CDC command opcode indicating the type of command being replied to. |
size | 1–2 | Size of payload encoded as a VarU16 . |
payload | n | Encoded payload. |
Fields§
§size: u16
Packet Payload Size
payload: P
Packet Payload
Contains data for a given packet that be encoded and sent over serial to the host.
Implementations§
Trait Implementations§
Source§impl<const CMD: u8, P: Clone + Decode> Clone for CdcReplyPacket<CMD, P>
impl<const CMD: u8, P: Clone + Decode> Clone for CdcReplyPacket<CMD, P>
Source§fn clone(&self) -> CdcReplyPacket<CMD, P>
fn clone(&self) -> CdcReplyPacket<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 + Decode> Copy for CdcReplyPacket<CMD, P>
impl<const CMD: u8, P: Eq + Decode> Eq for CdcReplyPacket<CMD, P>
impl<const CMD: u8, P: Decode> StructuralPartialEq for CdcReplyPacket<CMD, P>
Auto Trait Implementations§
impl<const CMD: u8, P> Freeze for CdcReplyPacket<CMD, P>where
P: Freeze,
impl<const CMD: u8, P> RefUnwindSafe for CdcReplyPacket<CMD, P>where
P: RefUnwindSafe,
impl<const CMD: u8, P> Send for CdcReplyPacket<CMD, P>where
P: Send,
impl<const CMD: u8, P> Sync for CdcReplyPacket<CMD, P>where
P: Sync,
impl<const CMD: u8, P> Unpin for CdcReplyPacket<CMD, P>where
P: Unpin,
impl<const CMD: u8, P> UnwindSafe for CdcReplyPacket<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