Struct CanRemoteFrame

Source
pub struct CanRemoteFrame(/* private fields */);
Expand description

The classic CAN 2.0 remote request frame.

This is is meant to request a transmission by another node on the bus. It contain no data.

This is highly compatible with the can_frame from libc. (ref)

Implementations§

Source§

impl CanRemoteFrame

Source

pub fn set_dlc(&mut self, dlc: usize) -> Result<(), ConstructionError>

Sets the data length code for the frame

Trait Implementations§

Source§

impl AsPtr for CanRemoteFrame

Source§

fn as_ptr(&self) -> *const Self::Inner

Gets a pointer to the CAN frame structure that is compatible with the Linux C API.

Source§

fn as_mut_ptr(&mut self) -> *mut Self::Inner

Gets a mutable pointer to the CAN frame structure that is compatible with the Linux C API.

Source§

type Inner = can_frame

The inner type to which we resolve as a pointer
Source§

fn size(&self) -> usize

The size of the inner type
Source§

fn as_bytes(&self) -> &[u8]

Gets a byte slice to the inner type
Source§

fn as_bytes_mut(&mut self) -> &[u8]

Gets a mutable byte slice to the inner type
Source§

impl AsRef<can_frame> for CanRemoteFrame

Source§

fn as_ref(&self) -> &can_frame

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for CanRemoteFrame

Source§

fn clone(&self) -> CanRemoteFrame

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CanRemoteFrame

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CanRemoteFrame

Source§

fn default() -> Self

The default remote frame has all fields and data set to zero, and all flags off.

Source§

impl Frame for CanRemoteFrame

Source§

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

Create a new CAN 2.0 remote frame

Source§

fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>

Create a new remote transmission request frame.

This will set the RTR flag in the CAN ID word.

Source§

fn is_extended(&self) -> bool

Check if frame uses 29-bit extended ID format.

Source§

fn is_remote_frame(&self) -> bool

Check if frame is a remote transmission request.

Source§

fn id(&self) -> Id

Return the frame identifier.

Source§

fn dlc(&self) -> usize

Data length code

Source§

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

A slice into the actual data. Slice will always be <= 8 bytes in length

Source§

fn is_standard(&self) -> bool

Returns true if this frame is a standard frame.
Source§

fn is_data_frame(&self) -> bool

Returns true if this frame is a data frame.
Source§

impl Frame for CanRemoteFrame

Source§

fn id_word(&self) -> canid_t

Get the composite SocketCAN ID word, with EFF/RTR/ERR flags

Source§

fn set_id(&mut self, id: impl Into<Id>)

Sets the CAN ID for the frame.

This will set the RTR flag in the CAN ID word.

Source§

fn set_data(&mut self, data: &[u8]) -> Result<(), ConstructionError>

Sets the data payload of the frame. For the Remote frame, this just updates the DLC to the length of the data slice.

Source§

fn from_raw_id(id: u32, data: &[u8]) -> Option<Self>

Creates a frame using a raw, integer CAN ID. Read more
Source§

fn remote_from_raw_id(id: u32, dlc: usize) -> Option<Self>

Creates a remote frame using a raw, integer CAN ID. Read more
Source§

fn raw_id(&self) -> canid_t

Return the actual raw CAN ID (without EFF/RTR/ERR flags)
Source§

fn id_flags(&self) -> IdFlags

Returns the EFF/RTR/ERR flags from the ID word
Source§

fn can_id(&self) -> CanId

Return the CAN ID.
Source§

fn hal_id(&self) -> Id

Return the CAN ID as the embedded HAL Id type.
Source§

fn len(&self) -> usize

Get the data length
Source§

fn is_error_frame(&self) -> bool

Check if frame is an error message
Source§

impl From<CanRemoteFrame> for CanAnyFrame

Source§

fn from(frame: CanRemoteFrame) -> Self

Converts to this type from the input type.
Source§

impl From<CanRemoteFrame> for CanFrame

Source§

fn from(frame: CanRemoteFrame) -> Self

Create a CanFrame from a remote frame

Source§

impl TryFrom<CanAnyFrame> for CanRemoteFrame

Source§

type Error = ConstructionError

The type returned in the event of a conversion error.
Source§

fn try_from(frame: CanAnyFrame) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<CanFrame> for CanRemoteFrame

Source§

type Error = ConstructionError

The type returned in the event of a conversion error.
Source§

fn try_from(frame: CanFrame) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<can_frame> for CanRemoteFrame

Source§

fn try_from(frame: can_frame) -> Result<Self, Self::Error>

Try to create a CanRemoteFrame from a C can_frame

This will only succeed the C frame is marked as a remote frame.

Source§

type Error = ConstructionError

The type returned in the event of a conversion error.
Source§

impl UpperHex for CanRemoteFrame

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Copy for CanRemoteFrame

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ControllerSpecificErrorInformation for T
where T: Frame,

Source§

fn get_ctrl_err(&self) -> Option<&[u8]>

Get the controller specific error information.

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.