Struct bxcan::Frame[][src]

pub struct Frame { /* fields omitted */ }
Expand description

A CAN data or remote frame.

Implementations

impl Frame[src]

pub fn new_data(id: impl Into<Id>, data: impl Into<Data>) -> Self[src]

Creates a new data frame.

pub fn new_remote(id: impl Into<Id>, dlc: u8) -> Self[src]

Creates a new remote frame with configurable data length code (DLC).

Panics

This function will panic if dlc is not inside the valid range 0..=8.

pub fn is_extended(&self) -> bool[src]

Returns true if this frame is an extended frame.

pub fn is_standard(&self) -> bool[src]

Returns true if this frame is a standard frame.

pub fn is_remote_frame(&self) -> bool[src]

Returns true if this frame is a remote frame.

pub fn is_data_frame(&self) -> bool[src]

Returns true if this frame is a data frame.

pub fn id(&self) -> Id[src]

Returns the frame identifier.

pub fn priority(&self) -> FramePriority[src]

Returns the priority of this frame.

pub fn dlc(&self) -> u8[src]

Returns the data length code (DLC) which is in the range 0..8.

For data frames the DLC value always matches the length of the data. Remote frames do not carry any data, yet the DLC can be greater than 0.

pub fn data(&self) -> Option<&Data>[src]

Returns the frame data (0..8 bytes in length) if this is a data frame.

If this is a remote frame, returns None.

Trait Implementations

impl Clone for Frame[src]

fn clone(&self) -> Frame[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Frame[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Format for Frame[src]

fn format(&self, f: Formatter<'_>)[src]

Writes the defmt representation of self to fmt.

impl Frame for Frame[src]

fn new(id: impl Into<Id>, data: &[u8]) -> Result<Self, ()>[src]

Creates a new frame. Returns an error when the data slice is too long. Read more

fn new_remote(id: impl Into<Id>, dlc: usize) -> Result<Self, ()>[src]

Creates a new remote frame (RTR bit set). Returns an error when the data length code (DLC) is not valid. Read more

fn is_extended(&self) -> bool[src]

Returns true if this frame is a extended frame.

fn is_standard(&self) -> bool[src]

Returns true if this frame is a standard frame.

fn is_remote_frame(&self) -> bool[src]

Returns true if this frame is a remote frame.

fn is_data_frame(&self) -> bool[src]

Returns true if this frame is a data frame.

fn id(&self) -> Id[src]

Returns the frame identifier.

fn dlc(&self) -> usize[src]

Returns the data length code (DLC) which is in the range 0..8. Read more

fn data(&self) -> &[u8][src]

Returns the frame data (0..8 bytes in length).

impl PartialEq<Frame> for Frame[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Eq for Frame[src]

impl StructuralEq for Frame[src]

Auto Trait Implementations

impl Send for Frame

impl Sync for Frame

impl Unpin for Frame

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.