Struct bxcan::Data[][src]

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

Payload of a CAN data frame.

Contains 0 to 8 Bytes of data.

Data implements From<[u8; N]> for all N up to 8, which provides a convenient lossless conversion from fixed-length arrays.

Implementations

impl Data[src]

pub fn new(data: &[u8]) -> Option<Self>[src]

Creates a data payload from a raw byte slice.

Returns None if data contains more than 8 Bytes (which is the maximum).

Data can also be constructed from fixed-length arrays up to length 8 via From/Into.

pub const fn empty() -> Self[src]

Creates an empty data payload containing 0 bytes.

Trait Implementations

impl AsMut<[u8]> for Data[src]

fn as_mut(&mut self) -> &mut [u8][src]

Performs the conversion.

impl AsRef<[u8]> for Data[src]

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

Performs the conversion.

impl Clone for Data[src]

fn clone(&self) -> Data[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 Data[src]

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

Formats the value using the given formatter. Read more

impl Deref for Data[src]

type Target = [u8]

The resulting type after dereferencing.

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

Dereferences the value.

impl DerefMut for Data[src]

fn deref_mut(&mut self) -> &mut [u8][src]

Mutably dereferences the value.

impl Format for Data[src]

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

Writes the defmt representation of self to fmt.

impl From<[u8; 0]> for Data[src]

fn from(arr: [u8; 0]) -> Self[src]

Performs the conversion.

impl From<[u8; 1]> for Data[src]

fn from(arr: [u8; 1]) -> Self[src]

Performs the conversion.

impl From<[u8; 2]> for Data[src]

fn from(arr: [u8; 2]) -> Self[src]

Performs the conversion.

impl From<[u8; 3]> for Data[src]

fn from(arr: [u8; 3]) -> Self[src]

Performs the conversion.

impl From<[u8; 4]> for Data[src]

fn from(arr: [u8; 4]) -> Self[src]

Performs the conversion.

impl From<[u8; 5]> for Data[src]

fn from(arr: [u8; 5]) -> Self[src]

Performs the conversion.

impl From<[u8; 6]> for Data[src]

fn from(arr: [u8; 6]) -> Self[src]

Performs the conversion.

impl From<[u8; 7]> for Data[src]

fn from(arr: [u8; 7]) -> Self[src]

Performs the conversion.

impl From<[u8; 8]> for Data[src]

fn from(arr: [u8; 8]) -> Self[src]

Performs the conversion.

impl PartialEq<Data> for Data[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 Copy for Data[src]

impl Eq for Data[src]

Auto Trait Implementations

impl Send for Data

impl Sync for Data

impl Unpin for Data

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.