Struct Command

Source
pub struct Command<'a> {
    pub cla: u8,
    pub ins: u8,
    pub p1: u8,
    pub p2: u8,
    pub le: Option<u16>,
    pub payload: Option<&'a [u8]>,
}
Expand description

An APDU command to be transmitted

Fields§

§cla: u8§ins: u8§p1: u8§p2: u8§le: Option<u16>§payload: Option<&'a [u8]>

Implementations§

Source§

impl<'a> Command<'a>

Source

pub fn new(cla: u8, ins: u8, p1: u8, p2: u8) -> Self

Constructs an command with CLA, INS, P1, and P2. No payloads will be transmitted or received.

Source

pub fn new_with_le(cla: u8, ins: u8, p1: u8, p2: u8, le: u16) -> Self

Constructs an command with CLA, INS, P1, P2, and Le. A payload will be received.

Source

pub fn new_with_payload( cla: u8, ins: u8, p1: u8, p2: u8, payload: &'a [u8], ) -> Self

Constructs an command with CLA, INS, P1, P2, and a payload. No payload will be received.

Source

pub fn new_with_payload_le( cla: u8, ins: u8, p1: u8, p2: u8, le: u16, payload: &'a [u8], ) -> Self

Constructs an command with CLA, INS, P1, P2, Le, and a payload. A payload will be received.

Source

pub fn write(&self, buf: &mut [u8])

Writes a serialised byte stream onto the mutable buffer.

Source

pub fn len(&self) -> usize

Calculates the length of entire the command.

Trait Implementations§

Source§

impl<'a> Debug for Command<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<Command<'a>> for Vec<u8>

Source§

fn from(command: Command<'_>) -> Self

Converts the command into octets.

Auto Trait Implementations§

§

impl<'a> Freeze for Command<'a>

§

impl<'a> RefUnwindSafe for Command<'a>

§

impl<'a> Send for Command<'a>

§

impl<'a> Sync for Command<'a>

§

impl<'a> Unpin for Command<'a>

§

impl<'a> UnwindSafe for Command<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.