Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl LedgerAsync for Ledger

Available on non-WebAssembly only.