pub trait CanDevice: Clone + TryFrom<DeviceBuilder, Error = Error> {
type Channel: Display;
type Frame: Frame<Channel = Self::Channel>;
// Required methods
fn opened_channels(&self) -> Vec<Self::Channel>;
fn transmit(
&self,
msg: Self::Frame,
timeout: Option<u32>,
) -> CanResult<(), Error>;
fn receive(
&self,
channel: Self::Channel,
timeout: Option<u32>,
) -> CanResult<Vec<Self::Frame>, Error>;
fn shutdown(&mut self);
// Provided method
fn is_closed(&self) -> bool { ... }
}Required Associated Types§
Required Methods§
Sourcefn opened_channels(&self) -> Vec<Self::Channel>
fn opened_channels(&self) -> Vec<Self::Channel>
get all channels that has opened
Sourcefn transmit(
&self,
msg: Self::Frame,
timeout: Option<u32>,
) -> CanResult<(), Error>
fn transmit( &self, msg: Self::Frame, timeout: Option<u32>, ) -> CanResult<(), Error>
Transmit a CAN or CAN-FD Frame.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.