pub struct FlightMode { /* private fields */ }Expand description
Represents a Flight Mode packet.
Contains the flight mode as a null-terminated string.
Implementations§
Source§impl FlightMode
impl FlightMode
Sourcepub fn new(flight_mode: &str) -> Result<Self, CrsfParsingError>
pub fn new(flight_mode: &str) -> Result<Self, CrsfParsingError>
Creates a new FlightMode packet from a string slice.
The flight mode string must not be longer than 59 bytes.
Sourcepub fn flight_mode(&self) -> &str
pub fn flight_mode(&self) -> &str
Returns the flight mode as a string slice.
Trait Implementations§
Source§impl Clone for FlightMode
impl Clone for FlightMode
Source§fn clone(&self) -> FlightMode
fn clone(&self) -> FlightMode
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 CrsfPacket for FlightMode
impl CrsfPacket for FlightMode
Source§const PACKET_TYPE: PacketType = PacketType::FlightMode
const PACKET_TYPE: PacketType = PacketType::FlightMode
The CRSF frame type identifier for this packet.
Source§const MIN_PAYLOAD_SIZE: usize = 1usize
const MIN_PAYLOAD_SIZE: usize = 1usize
The minimum expected length of the packet’s payload in bytes.
For fixed-size packets, this is the same as the payload size.
fn to_bytes(&self, buffer: &mut [u8]) -> Result<usize, CrsfParsingError>
Source§fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
fn from_bytes(data: &[u8]) -> Result<Self, CrsfParsingError>
Creates a packet instance from a payload byte slice.
The slice is guaranteed to have a length of at least
MIN_PAYLOAD_SIZE.fn validate_buffer_size(&self, buffer: &[u8]) -> Result<(), CrsfParsingError>
Source§impl Debug for FlightMode
impl Debug for FlightMode
Source§impl PartialEq for FlightMode
impl PartialEq for FlightMode
impl StructuralPartialEq for FlightMode
Auto Trait Implementations§
impl Freeze for FlightMode
impl RefUnwindSafe for FlightMode
impl Send for FlightMode
impl Sync for FlightMode
impl Unpin for FlightMode
impl UnwindSafe for FlightMode
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