Trait coins_ledger::transports::LedgerAsync
source · 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§
sourcefn init<'async_trait>(
) -> Pin<Box<dyn Future<Output = Result<Self, LedgerError>> + 'async_trait>>where
Self: 'async_trait,
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.
sourcefn 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,
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.