From 1dca0fa36cd4ad1076bce4f444737f46b9eb906c Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Sun, 13 Sep 2020 16:22:35 -0700 Subject: [PATCH] Make apdu-dispatch build standalone and fix tests --- src/command/instruction.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/command/instruction.rs b/src/command/instruction.rs index c801b7b..e7cb10f 100644 --- a/src/command/instruction.rs +++ b/src/command/instruction.rs @@ -35,6 +35,25 @@ impl core::convert::From for Instruction { } } +impl core::convert::Into for Instruction { + fn into(self) -> u8 { + match self { + Instruction::Verify => 0x20, + Instruction::ChangeReferenceData => 0x24, + Instruction::ResetRetryCounter => 0x2c, + Instruction::GenerateAsymmetricKeyPair => 0x47, + Instruction::GeneralAuthenticate => 0x87, + Instruction::Select => 0xa4, + Instruction::GetResponse => 0xc0, + Instruction::GetData => 0xcb, + Instruction::PutData => 0xdb, + Instruction::ReadBinary => 0xb0, + Instruction::WriteBinary => 0xd0, + Instruction::Unknown(ins) => ins, + } + } +} + // impl core::convert::TryFrom for Instruction { // type Error = UnknownInstruction;