siketyan / apdu-rs Goto Github PK
View Code? Open in Web Editor NEW๐ฆ Rust library to compose or parse APDU commands and responses.
๐ฆ Rust library to compose or parse APDU commands and responses.
We want to keep apdu-core crate fully cross-platform.
This means we are also going to support no_std environment in the crate.
To achieve this objective, we need to move From<Vec<u8>>
implementation from apdu-core.
I noticed that apdu-rs does not implement Debug
for all public types. After adding #![warn(missing_debug_implementations)]
to all crates, the compiler tells me that they are missing for the following types:
apdu_core::Command
apdu::command::ReadBinaryCommand
apdu::command::SelectFileCommand
apdu::command::VerifyCommand
This makes debugging quite a bit harder than it needs to be. Is this by design, or simply an oversight? If the latter, would you welcome a pull request enabling the missing_debug_implementations
warning and adding Debug
impls for those types?
I found this crate by chance yesterday. I thought I could use it for a Rust-embedded demo with some NFC tags I have (but I don't have the right type of tags).
That said, I tried compiling the crate as a test. The README.md
says apdu-core
supports no-std
environments. But when I try to compile it, I an error saying the crate needs alloc
, which leads to a bunch of other errors:
$ cargo +nightly build -p apdu-core --target=msp430-none-elf --no-default-features -Zbuild-std=core
Compiling apdu-core v0.2.1 (C:\msys64\home\William\Projects\rust-embedded\apdu-rs\apdu-core)
error[E0463]: can't find crate for `alloc`
--> apdu-core\src\lib.rs:5:1
|
5 | extern crate alloc;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
error: cannot determine resolution for the macro `vec`
--> apdu-core\src\command.rs:80:35
|
80 | let mut buffer: Vec<u8> = vec![cla, ins, p1, p2];
| ^^^
|
= note: import resolution is stuck, try simplifying macro imports
error[E0412]: cannot find type `Vec` in this scope
--> apdu-core\src\response.rs:6:18
|
6 | pub payload: Vec<u8>,
| ^^^ not found in this scope
error[E0412]: cannot find type `Vec` in this scope
--> apdu-core\src\response.rs:22:11
|
22 | impl From<Vec<u8>> for Response {
| ^^^ not found in this scope
error[E0412]: cannot find type `Vec` in this scope
--> apdu-core\src\response.rs:23:24
|
23 | fn from(mut bytes: Vec<u8>) -> Self {
| ^^^ not found in this scope
error[E0412]: cannot find type `Vec` in this scope
--> apdu-core\src\response.rs:37:32
|
37 | impl From<Response> for Result<Vec<u8>, Error> {
| ^^^ not found in this scope
error[E0282]: type annotations needed
--> apdu-core\src\command.rs:24:22
|
24 | payload: None,
| ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
|
help: consider specifying the generic argument
|
24 | payload: None::<T>,
| +++++
error[E0282]: type annotations needed
--> apdu-core\src\command.rs:37:22
|
37 | payload: None,
| ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
|
help: consider specifying the generic argument
|
37 | payload: None::<T>,
| +++++
error[E0283]: type annotations needed
--> apdu-core\src\response.rs:6:5
|
4 | #[derive(Debug, Default)]
| ------- in this derive macro expansion
5 | pub struct Response {
6 | pub payload: Vec<u8>,
| ^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
= note: cannot satisfy `_: Default`
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0282, E0283, E0412, E0463.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `apdu-core` due to 9 previous errors
msp430-none-elf
is just an example here; it doesn't support alloc
and probably never will. Is it possible to make apdu-core
support fixed buffer sizes to be usable without alloc
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.