Struct coins_ledger::common::APDUAnswer[][src]

pub struct APDUAnswer { /* fields omitted */ }

An APDU response is a wrapper around some response bytes. To avoid unnecessary clones, it exposes the retcode and response data as getters.

Implementations

impl APDUAnswer[src]

pub fn from_answer(response: Vec<u8>) -> Result<APDUAnswer, LedgerError>[src]

instantiate a

pub fn len(&self) -> usize[src]

Return the response length in bytes

pub fn is_empty(&self) -> bool[src]

True if the underlying slice is empty, else false.

pub fn is_success(&self) -> bool[src]

Return false if the response status is an error.

pub fn retcode(&self) -> u16[src]

Get the integer response code from the response packet.

Panics if the buffer is too short (some device error).

pub fn response_status(&self) -> APDUResponseCodes[src]

Return the Response code

Panics on unknown retcode.

pub fn data(&self) -> Option<&[u8]>[src]

Return a reference to the response data, or None if the response errored

Trait Implementations

impl Clone for APDUAnswer[src]

impl Debug for APDUAnswer[src]

impl Display for APDUAnswer[src]

impl Eq for APDUAnswer[src]

impl PartialEq<APDUAnswer> for APDUAnswer[src]

impl StructuralEq for APDUAnswer[src]

impl StructuralPartialEq for APDUAnswer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.