Trait AsyncLink

Source
pub trait AsyncLink: Send {
    // Required methods
    fn open<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        geometry: &'life1 Geometry,
    ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn alloc_tx_buffer<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TxMessage>, LinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send<'life0, 'async_trait>(
        &'life0 mut self,
        tx: Vec<TxMessage>,
    ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn receive<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        rx: &'life1 mut [RxMessage],
    ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_open(&self) -> bool;

    // Provided method
    fn ensure_is_open(&self) -> Result<(), LinkError> { ... }
}
Available on crate features async and link only.
Expand description

A trait that provides the interface with the device.

Required Methods§

Source

fn open<'life0, 'life1, 'async_trait>( &'life0 mut self, geometry: &'life1 Geometry, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Opens the link.

Source

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the link.

Source

fn alloc_tx_buffer<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TxMessage>, LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Allocate a sending buffer for the link.

Source

fn send<'life0, 'async_trait>( &'life0 mut self, tx: Vec<TxMessage>, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a message to the device.

Source

fn receive<'life0, 'life1, 'async_trait>( &'life0 mut self, rx: &'life1 mut [RxMessage], ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Receives a message from the device.

Source

fn is_open(&self) -> bool

Checks if the link is open.

Provided Methods§

Source

fn ensure_is_open(&self) -> Result<(), LinkError>

Ensures that the link is open, returning an error if it is not.

Trait Implementations§

Source§

fn open<'life0, 'life1, 'async_trait>( &'life0 mut self, geometry: &'life1 Geometry, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Opens the link.
Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the link.
Source§

fn alloc_tx_buffer<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TxMessage>, LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Allocate a sending buffer for the link.
Source§

fn send<'life0, 'async_trait>( &'life0 mut self, tx: Vec<TxMessage>, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a message to the device.
Source§

fn receive<'life0, 'life1, 'async_trait>( &'life0 mut self, rx: &'life1 mut [RxMessage], ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Receives a message from the device.
Source§

fn is_open(&self) -> bool

Checks if the link is open.
Source§

fn ensure_is_open(&self) -> Result<(), LinkError>

Ensures that the link is open, returning an error if it is not.

Implementations on Foreign Types§

Source§

fn open<'life0, 'life1, 'async_trait>( &'life0 mut self, geometry: &'life1 Geometry, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn close<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn alloc_tx_buffer<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TxMessage>, LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn send<'life0, 'async_trait>( &'life0 mut self, tx: Vec<TxMessage>, ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn receive<'life0, 'life1, 'async_trait>( &'life0 mut self, rx: &'life1 mut [RxMessage], ) -> Pin<Box<dyn Future<Output = Result<(), LinkError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn is_open(&self) -> bool

Implementors§