pub struct ResponsePacket<const N: usize = 256> { /* private fields */ }Implementations§
Source§impl<const N: usize> ResponsePacket<N>
impl<const N: usize> ResponsePacket<N>
pub const fn new() -> Self
pub fn from_reader(reader: &mut impl ReadPacket) -> Result<Self>
Sourcepub fn from_slice(slice: &[u8]) -> Self
pub fn from_slice(slice: &[u8]) -> Self
Initialize a struct from a slice.
§Panics
If the slice length is less than 4 and more than N. The slice can’t be less than 4 because the packet is always has at least 4 bytes.
Trait Implementations§
Source§impl<const N: usize> Clone for ResponsePacket<N>
impl<const N: usize> Clone for ResponsePacket<N>
Source§fn clone(&self) -> ResponsePacket<N>
fn clone(&self) -> ResponsePacket<N>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for ResponsePacket<N>
impl<const N: usize> Debug for ResponsePacket<N>
Source§impl<const N: usize> Default for ResponsePacket<N>
impl<const N: usize> Default for ResponsePacket<N>
Source§impl<const N: usize> Packet for ResponsePacket<N>
impl<const N: usize> Packet for ResponsePacket<N>
const SIZE_INDEX: usize = 2usize
const DATA_BEGIN_INDEX: usize = 4usize
const DESTINATION_INDEX: usize = 1usize
fn len_of_packet(&self) -> usize
Source§fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice of the packet until SUM byte.
fn set_sync(&mut self) -> &mut Self
Source§fn size(&self) -> u8
fn size(&self) -> u8
Returns a SIZE byte at
Packet::SIZE_INDEXSource§fn set_size(&mut self, size: u8) -> &mut Self
fn set_size(&mut self, size: u8) -> &mut Self
Sets a size byte at
Packet::SIZE_INDEX. Read moreSource§fn dest(&self) -> u8
fn dest(&self) -> u8
Returns a destination byte at
Packet::DESTINATION_INDEX.Source§fn set_dest(&mut self, dest: u8) -> &mut Self
fn set_dest(&mut self, dest: u8) -> &mut Self
Sets a destination byte at
Packet::DESTINATION_INDEX and calculates a new checksum.Source§fn calculate_checksum(&mut self) -> &mut Self
fn calculate_checksum(&mut self) -> &mut Self
Calculates checksum. Read more
Source§fn set_checksum(&mut self, checksum: u8) -> &mut Self
fn set_checksum(&mut self, checksum: u8) -> &mut Self
Sets a checksum in the end of the packet. Read more
Source§impl<const N: usize> ReportField for ResponsePacket<N>
impl<const N: usize> ReportField for ResponsePacket<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for ResponsePacket<N>
impl<const N: usize> RefUnwindSafe for ResponsePacket<N>
impl<const N: usize> Send for ResponsePacket<N>
impl<const N: usize> Sync for ResponsePacket<N>
impl<const N: usize> Unpin for ResponsePacket<N>
impl<const N: usize> UnwindSafe for ResponsePacket<N>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)