ledger_lib

Trait Device

Source
pub trait Device {
    // Required method
    fn request<'a, 'b, 'life0, 'async_trait, RESP>(
        &'life0 mut self,
        request: impl 'async_trait + ApduReq<'a> + Send,
        buff: &'b mut [u8],
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<RESP, Error>> + Send + 'async_trait>>
       where RESP: 'async_trait + EncDec<'b, ApduError>,
             Self: 'async_trait,
             'a: 'async_trait,
             'b: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn app_info<'life0, 'async_trait>(
        &'life0 mut self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<AppInfo, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn device_info<'life0, 'async_trait>(
        &'life0 mut self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<DeviceInfo, Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Device provides a high-level interface exchanging APDU objects with implementers of Exchange

Required Methods§

Source

fn request<'a, 'b, 'life0, 'async_trait, RESP>( &'life0 mut self, request: impl 'async_trait + ApduReq<'a> + Send, buff: &'b mut [u8], timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<RESP, Error>> + Send + 'async_trait>>
where RESP: 'async_trait + EncDec<'b, ApduError>, Self: 'async_trait, 'a: 'async_trait, 'b: 'async_trait, 'life0: 'async_trait,

Issue a request APDU, returning a reponse APDU

Provided Methods§

Source

fn app_info<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<AppInfo, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Fetch application information

Source

fn device_info<'life0, 'async_trait>( &'life0 mut self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<DeviceInfo, Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Fetch device information

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<T: Exchange + Send> Device for T

Generic Device implementation for types supporting Exchange