I've created a program which works as expected:
extern crate base64;
// decode base64
let bytes = base64::decode(res[1]).unwrap();
[dependencies]
base64 = "0.13.0"
serde_json = "1.0.64"
When I add this code to Webassembly for an Envoy filter with base64 lib , I get the error:
INFO: From Compiling Rust cdylib filter (1 files):
error[E0463]: can't find crate for `base64`
--> filter.rs:1:1
|
1 | extern crate base64;
| ^^^^^^^^^^^^^^^^^^^^ can't find crate
This playground works with the default "Run" button, but this playground doesn't work if you run it as "Wasm". You will get the error which described above. Both links have the exact same code.
my cargo.toml look like following
[dependencies]
base64 = "0.13.0"
serde_json = "1.0.64"
serde = { version = "1.0.126", features = ["derive"] }
It seems that web-assemble rust doesn't support base64
lib (as far as I understand it as I'm new to Rust)
My question: which options I have to overcome this issue ?**
How to reproduce the full scenario (quite simple with the following steps)
Download wasme
(which generate a rust project)
curl -sL https://run.solo.io/wasme/install | sh
Init skeleton project
wasme init ./new-filter ---> choose rust
Add to the filter.rs
file the base64 code
Run the build
wasme build rust -t mytest . (needs docker)
More info about wasme
etc could be found here
And you will see the error which I provided above and is the same as the run the playground with WASM
If something is missing or isn't clear please let me know and I'll add