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