pub trait LedgerAsync: Sized {
    // Required methods
    fn init<'async_trait>(
    ) -> Pin<Box<dyn Future<Output = Result<Self, LedgerError>> + '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>> + '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 function acquires a lock on the device.

Required Methods§

source

fn init<'async_trait>( ) -> Pin<Box<dyn Future<Output = Result<Self, LedgerError>> + '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>> + '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.

Implementors§