CanDevice

Trait CanDevice 

Source
pub trait CanDevice:
    Send
    + Sync
    + TryFrom<DeviceBuilder<Self::Channel>, Error = Error> {
    type Channel: Hash + Eq + 'static;
    type Frame: Frame<Channel = Self::Channel>;

    // Required methods
    fn opened_channels(&self) -> Vec<Self::Channel>;
    fn transmit<'life0, 'async_trait>(
        &'life0 self,
        msg: Self::Frame,
        timeout: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = CanResult<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn receive<'life0, 'async_trait>(
        &'life0 self,
        channel: Self::Channel,
        timeout: Option<u32>,
    ) -> Pin<Box<dyn Future<Output = CanResult<Vec<Self::Frame>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown(&mut self);

    // Provided method
    fn is_closed(&self) -> bool { ... }
}

Required Associated Types§

Source

type Channel: Hash + Eq + 'static

Source

type Frame: Frame<Channel = Self::Channel>

Required Methods§

Source

fn opened_channels(&self) -> Vec<Self::Channel>

get all channels that has opened

Source

fn transmit<'life0, 'async_trait>( &'life0 self, msg: Self::Frame, timeout: Option<u32>, ) -> Pin<Box<dyn Future<Output = CanResult<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transmit a CAN or CAN-FD Frame.

Source

fn receive<'life0, 'async_trait>( &'life0 self, channel: Self::Channel, timeout: Option<u32>, ) -> Pin<Box<dyn Future<Output = CanResult<Vec<Self::Frame>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive CAN and CAN-FD Frames.

Source

fn shutdown(&mut self)

Close CAN device.

Provided Methods§

Source

fn is_closed(&self) -> bool

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.

Implementors§