pub struct RawCrsfPacket<'a> { /* private fields */ }Expand description
Represents a valid, but unparsed, CRSF packet.
This struct is a zero-copy view into a byte buffer that has been validated to contain a complete CRSF packet, including the sync byte, length, type, payload, and CRC. It provides methods to access the different parts of the packet without parsing the payload itself.
Implementations§
Source§impl<'a> RawCrsfPacket<'a>
impl<'a> RawCrsfPacket<'a>
Sourcepub fn new(bytes: &'a [u8]) -> Option<Self>
pub fn new(bytes: &'a [u8]) -> Option<Self>
Creates a new RawCrsfPacket from a byte slice.
Returns None if the slice is shorter than the minimum possible
CRSF packet length (4 bytes).
Sourcepub fn raw_packet_type(&self) -> u8
pub fn raw_packet_type(&self) -> u8
Returns the raw packet type byte.
Sourcepub fn payload(&self) -> &[u8]
pub fn payload(&self) -> &[u8]
Returns a slice representing the packet’s payload.
The payload does not include the CRSF framing (destination, size, type, CRC).
Trait Implementations§
Source§impl<'a> Clone for RawCrsfPacket<'a>
impl<'a> Clone for RawCrsfPacket<'a>
Source§fn clone(&self) -> RawCrsfPacket<'a>
fn clone(&self) -> RawCrsfPacket<'a>
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 moreSource§impl<'a> Debug for RawCrsfPacket<'a>
impl<'a> Debug for RawCrsfPacket<'a>
Source§impl<'a> Ord for RawCrsfPacket<'a>
impl<'a> Ord for RawCrsfPacket<'a>
Source§fn cmp(&self, other: &RawCrsfPacket<'a>) -> Ordering
fn cmp(&self, other: &RawCrsfPacket<'a>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq for RawCrsfPacket<'a>
impl<'a> PartialEq for RawCrsfPacket<'a>
Source§impl<'a> PartialOrd for RawCrsfPacket<'a>
impl<'a> PartialOrd for RawCrsfPacket<'a>
impl<'a> Eq for RawCrsfPacket<'a>
impl<'a> StructuralPartialEq for RawCrsfPacket<'a>
Auto Trait Implementations§
impl<'a> Freeze for RawCrsfPacket<'a>
impl<'a> RefUnwindSafe for RawCrsfPacket<'a>
impl<'a> Send for RawCrsfPacket<'a>
impl<'a> Sync for RawCrsfPacket<'a>
impl<'a> Unpin for RawCrsfPacket<'a>
impl<'a> UnwindSafe for RawCrsfPacket<'a>
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