Use arrayref for converting into ApduHeader
This commit is contained in:
@@ -58,8 +58,8 @@ pub struct ApduHeader {
|
|||||||
p2: u8,
|
p2: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&[u8]> for ApduHeader {
|
impl From<&[u8; 4]> for ApduHeader {
|
||||||
fn from(header: &[u8]) -> Self {
|
fn from(header: &[u8; 4]) -> Self {
|
||||||
ApduHeader {
|
ApduHeader {
|
||||||
cla: header[0],
|
cla: header[0],
|
||||||
ins: header[1],
|
ins: header[1],
|
||||||
@@ -120,7 +120,7 @@ impl TryFrom<&[u8]> for APDU {
|
|||||||
let (header, payload) = frame.split_at(APDU_HEADER_LEN);
|
let (header, payload) = frame.split_at(APDU_HEADER_LEN);
|
||||||
|
|
||||||
let mut apdu = APDU {
|
let mut apdu = APDU {
|
||||||
header: header.into(),
|
header: array_ref!(header, 0, 4).into(),
|
||||||
lc: 0x00,
|
lc: 0x00,
|
||||||
data: Vec::new(),
|
data: Vec::new(),
|
||||||
le: 0x00,
|
le: 0x00,
|
||||||
|
|||||||
@@ -18,3 +18,7 @@ extern crate alloc;
|
|||||||
|
|
||||||
pub mod ctap;
|
pub mod ctap;
|
||||||
pub mod embedded_flash;
|
pub mod embedded_flash;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate arrayref;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ extern crate alloc;
|
|||||||
extern crate core;
|
extern crate core;
|
||||||
extern crate lang_items;
|
extern crate lang_items;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
extern crate arrayref;
|
||||||
|
|
||||||
mod ctap;
|
mod ctap;
|
||||||
pub mod embedded_flash;
|
pub mod embedded_flash;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user