pub struct ClassicFrame(/* private fields */);Expand description
A frame that is known to be classic CAN, for code written against
embedded-can.
embedded_can::Frame promises at most 8 bytes of data, which a Frame
cannot keep: a 64-byte FD frame is a Frame too. The trait is therefore
implemented on this type, which the trait constructors build directly and
which TryFrom<Frame> refuses to make from an FD frame.
The type dereferences to the Frame it wraps and converts back into one
for CanFd::transmit.
Implementations§
Source§impl ClassicFrame
impl ClassicFrame
Sourcepub fn into_frame(self) -> Frame
pub fn into_frame(self) -> Frame
Returns the frame this wraps.
Methods from Deref<Target = Frame>§
Sourcepub fn with_bit_rate_switch(self, bit_rate_switch: bool) -> Self
pub fn with_bit_rate_switch(self, bit_rate_switch: bool) -> Self
Sets whether the data phase is sent at the FD bit rate.
Only a CAN FD frame can switch bit rate; the setting is ignored on a classic frame.
Sourcepub fn requested_len(&self) -> usize
pub fn requested_len(&self) -> usize
Returns the payload length a request frame asks for, in bytes.
Zero for a data frame, whose length is Frame::len.
Sourcepub fn dlc(&self) -> u8
pub fn dlc(&self) -> u8
Returns the data length code the frame is sent with.
A payload length that no code expresses is padded up to the next one,
so a received copy of the frame can be longer than Frame::len.
Sourcepub fn is_extended(&self) -> bool
pub fn is_extended(&self) -> bool
Returns whether the identifier is a 29-bit extended one.
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Returns whether this is a request frame, which carries no payload.
Sourcepub fn is_bit_rate_switched(&self) -> bool
pub fn is_bit_rate_switched(&self) -> bool
Returns whether the data phase uses the FD bit rate.
Sourcepub fn error_state_indicator(&self) -> bool
pub fn error_state_indicator(&self) -> bool
Returns the error state indicator of the transmitting node.
Sourcepub fn timestamp(&self) -> u64
pub fn timestamp(&self) -> u64
Returns the timestamp captured when the frame was received.
Zero for a frame that was not received; see
CanFd::start_timestamp_timer.
Trait Implementations§
Source§impl Clone for ClassicFrame
Available on crate feature unstable only.
impl Clone for ClassicFrame
unstable only.impl Copy for ClassicFrame
unstable only.Source§impl Debug for ClassicFrame
Available on crate feature unstable only.
impl Debug for ClassicFrame
unstable only.Source§impl Deref for ClassicFrame
Available on crate feature unstable only.
impl Deref for ClassicFrame
unstable only.Source§impl Frame for ClassicFrame
Available on crate feature unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
impl Frame for ClassicFrame
unstable only.§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Source§fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
Source§fn is_extended(&self) -> bool
fn is_extended(&self) -> bool
Source§fn is_remote_frame(&self) -> bool
fn is_remote_frame(&self) -> bool
Source§fn dlc(&self) -> usize
fn dlc(&self) -> usize
Source§fn is_standard(&self) -> bool
fn is_standard(&self) -> bool
Source§fn is_data_frame(&self) -> bool
fn is_data_frame(&self) -> bool
Source§impl From<ClassicFrame> for Frame
Available on crate feature unstable only.
impl From<ClassicFrame> for Frame
unstable only.Source§fn from(frame: ClassicFrame) -> Self
fn from(frame: ClassicFrame) -> Self
Source§impl TryFrom<Frame> for ClassicFrame
Available on crate feature unstable only.
impl TryFrom<Frame> for ClassicFrame
unstable only.Source§fn try_from(frame: Frame) -> Result<Self, FrameError>
fn try_from(frame: Frame) -> Result<Self, FrameError>
§Errors
FrameError::NotClassic when the frame uses the CAN FD format.
Source§type Error = FrameError
type Error = FrameError
Auto Trait Implementations§
impl Freeze for ClassicFrame
impl RefUnwindSafe for ClassicFrame
impl Send for ClassicFrame
impl Sync for ClassicFrame
impl Unpin for ClassicFrame
impl UnsafeUnpin for ClassicFrame
impl UnwindSafe for ClassicFrame
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)