Link

Trait Link 

Source
pub trait Link: Send {
    // Required methods
    fn open(&mut self, geometry: &Geometry) -> Result<(), LinkError>;
    fn close(&mut self) -> Result<(), LinkError>;
    fn alloc_tx_buffer(&mut self) -> Result<Vec<TxMessage>, LinkError>;
    fn send(&mut self, tx: Vec<TxMessage>) -> Result<(), LinkError>;
    fn receive(&mut self, rx: &mut [RxMessage]) -> Result<(), LinkError>;
    fn is_open(&self) -> bool;

    // Provided method
    fn ensure_is_open(&self) -> Result<(), LinkError> { ... }
}
Expand description

A trait that provides the interface with the device.

Required Methods§

Source

fn open(&mut self, geometry: &Geometry) -> Result<(), LinkError>

Opens the link.

Source

fn close(&mut self) -> Result<(), LinkError>

Closes the link.

Source

fn alloc_tx_buffer(&mut self) -> Result<Vec<TxMessage>, LinkError>

Allocate a sending buffer for the link.

Source

fn send(&mut self, tx: Vec<TxMessage>) -> Result<(), LinkError>

Sends a message to the device.

Source

fn receive(&mut self, rx: &mut [RxMessage]) -> Result<(), LinkError>

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(&mut self, geometry: &Geometry) -> Result<(), LinkError>

Opens the link.
Source§

fn close(&mut self) -> Result<(), LinkError>

Closes the link.
Source§

fn alloc_tx_buffer(&mut self) -> Result<Vec<TxMessage>, LinkError>

Allocate a sending buffer for the link.
Source§

fn send(&mut self, tx: Vec<TxMessage>) -> Result<(), LinkError>

Sends a message to the device.
Source§

fn receive(&mut self, rx: &mut [RxMessage]) -> Result<(), LinkError>

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(&mut self, geometry: &Geometry) -> Result<(), LinkError>

Source§

fn close(&mut self) -> Result<(), LinkError>

Source§

fn alloc_tx_buffer(&mut self) -> Result<Vec<TxMessage>, LinkError>

Source§

fn send(&mut self, tx: Vec<TxMessage>) -> Result<(), LinkError>

Source§

fn receive(&mut self, rx: &mut [RxMessage]) -> Result<(), LinkError>

Source§

fn is_open(&self) -> bool

Implementors§