#[repr(C)]pub struct CanFrame { /* private fields */ }Expand description
CanFrame
Uses the same memory layout as the underlying kernel struct for performance reasons.
Implementations§
Source§impl CanFrame
impl CanFrame
pub fn new( id: u32, data: &[u8], rtr: bool, err: bool, ) -> Result<CanFrame, ConstructionError>
Sourcepub fn is_extended(&self) -> bool
pub fn is_extended(&self) -> bool
Check if frame uses 29 bit extended frame format
Sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
A slice into the actual data. Slice will always be <= 8 bytes in length
Sourcepub fn error(&self) -> Result<CanError, CanErrorDecodingFailure>
pub fn error(&self) -> Result<CanError, CanErrorDecodingFailure>
Read error from message and transform it into a CanError.
SocketCAN errors are indicated using the error bit and coded inside
id and data payload. Call error() converts these into usable
CanError instances.
If the frame is malformed, this may fail with a
CanErrorDecodingFailure.
Trait Implementations§
impl Copy for CanFrame
Auto Trait Implementations§
impl Freeze for CanFrame
impl RefUnwindSafe for CanFrame
impl Send for CanFrame
impl Sync for CanFrame
impl Unpin for CanFrame
impl UnwindSafe for CanFrame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more