Trait coins_ledger::transports::LedgerAsync

source ·
pub trait LedgerAsync: Sized {
    // Required methods
    fn init<'async_trait>(    ) -> Pin<Box<dyn Future<Output = Result<Self, LedgerError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn exchange<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packet: &'life1 APDUCommand,
    ) -> Pin<Box<dyn Future<Output = Result<APDUAnswer, LedgerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn close(self) { ... }
}
Expand description

An asynchronous interface to the Ledger device. It is critical that the device have only one connection active, so the init funnction acquires a lock on the device.

Required Methods§

source

fn init<'async_trait>() -> Pin<Box<dyn Future<Output = Result<Self, LedgerError>> + Send + 'async_trait>>
where Self: 'async_trait,

Init the connection to the device. This may fail if the device is already in use by some other process.

source

fn exchange<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 APDUCommand, ) -> Pin<Box<dyn Future<Output = Result<APDUAnswer, LedgerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Exchange a packet with the device.

Provided Methods§

source

fn close(self)

Consume the connection, and release the resources it holds.

By default this function simply drops the struct.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl LedgerAsync for Ledger

Available on non-WebAssembly only.