You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Other issues here mentioning wasm and the fact that I'm able to build a project using this via wasm-pack --target web made me think it's possible, but my lack of success and #15 being open made me ask this question to make sure.
I'm new to rust and haven't been having an easy time debugging or finding more info, so if it is possible to do this I'd appreciate any pointers on what to try.
cargo.toml
[package]
name = "test-lzma-wasm"version = "0.1.0"edition = "2021"
[dependencies]
console_error_panic_hook = "0.1.7"liblzma = { version = "0.3", features = ["static"] }
wasm-bindgen = "0.2"
[lib]
crate-type = ["cdylib"]
lib.rs (example copied from the docs)
use wasm_bindgen::prelude::*;externcrate console_error_panic_hook;use liblzma::read::{XzDecoder,XzEncoder};use std::io::prelude::*;#[wasm_bindgen]pubfnexample() -> String{
console_error_panic_hook::set_once();let data = "Hello, World!".as_bytes();let compressor = XzEncoder::new(data,9);// ""Narrowed"" down the error to this line.letmut decompressor = XzDecoder::new(compressor);letmut contents = String::new();
decompressor.read_to_string(&mut contents).unwrap();return contents;}
index.ts I'm able to run other functions, like a simple hello world one, but if the XzEncoder::new() line is uncommented this errors.
I tried in node and also as a <script> in a html file.
Other issues here mentioning wasm and the fact that I'm able to build a project using this via
wasm-pack --target web
made me think it's possible, but my lack of success and #15 being open made me ask this question to make sure.I'm new to rust and haven't been having an easy time debugging or finding more info, so if it is possible to do this I'd appreciate any pointers on what to try.
cargo.toml
lib.rs
(example copied from the docs)index.ts
I'm able to run other functions, like a simple hello world one, but if the XzEncoder::new() line is uncommented this errors.I tried in node and also as a <script> in a html file.
This is the error I get:
The text was updated successfully, but these errors were encountered: