Skip to content

Command and CommandView code duplication, avoidable edge cases #32

@dishmaker

Description

@dishmaker

Currently Command and CommandView<'a> implement the same logic that could be, respectively:

  • CAPDU<heapless::Vec<u8>>,
  • CAPDU<&[u8]>.

Also, current code covers edge cases that can be eliminated with rust enum of Short/Extended variants:

iso7816/src/command.rs

Lines 193 to 198 in 4eb8ac1

| (_, false, false, ExtendedLen::Forced) => {
unreachable!("Can't have non extended Lc and extended Le")
}
(_, true, true, _) => {
unreachable!("Can't have both no data and data extended length")
}

Maybe let's create a new crate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions