All Questions
26 questions
2
votes
1
answer
60
views
Rust WASM memory ptr is not same as JS Arraybuffer offset
I try to pass json content from js to rust with zero copy, but is seems the memory where rust vec ptr point to is not same as js arraybuffer with offset.
My Env:
cargo 1.83.0
wasm-pack 0.13.1
wasm-...
1
vote
0
answers
331
views
Build a wasm module from Rust to be used as a plugin for a Rust process reading it with Wasmer
I have a Rust project that wants to consume plugins distributed as wasm modules. The guides I see online are largely for running building/running wasm modules on the web and not exactly my use case.
I ...
0
votes
1
answer
1k
views
Achieve multi threading in WASM for making http requests (using reqwest crate)
I am trying to convert current implementation to WASM (for cloudflare workers).
But I have been facing problem with current implementation is that it uses multi threading to make requests, but I am ...
0
votes
1
answer
2k
views
Read a file with Rust WASM
I am trying to read a file called Book.txt within my Rust yew app. I am serving Book.txt using trunk's copy-file so that it is accessible from http://localhost:8080/Book.txt.
Trying to read the file ...
1
vote
2
answers
687
views
Using a function from a wasm module in JavaScript
I've decided to learn Rust alongside Web Assembly to get into more cloud computing. I'm trying to make a Rust app that connects to a Redis cache and increments a value each time a function is called. ...
2
votes
1
answer
803
views
How to publish a library for both browser and Node using wasm-pack?
I'm writing a wasm library that I want to be available in both the browser and Node. Does this mean I need to run both wasm-pack publish -t bundler and wasm-pack publish -t node? Is there a way to ...
1
vote
1
answer
130
views
How can I get the total number of files at build time and then pass it to web assembly in Yew?
I'm currently building an image carousel. I want to count the contents of a directory that is only accessible at the OS level and pass the result to a static hashmap inside a web assembly module in ...
0
votes
1
answer
1k
views
Rust/WebAssembly -- streaming HTTP request: convert JsValue from ReadableStreamDefaultReader.read into vector
I'm new to Rust and trying to implement a web page that shows a graph with many edges. I plan to use WebAssembly to lay out the graph and determine the positions of the nodes (and a WebGL library to ...
1
vote
1
answer
659
views
how to overcome memory limit on vector allocation in rust code assembled to WASM binaries
Update: created a small test app (react calling wasm rust code) but cant recreate rust exception, however this one liner is an extract from bit bigger function and I am still on to find what ...
2
votes
0
answers
3k
views
RuntimeError: memory access out of bounds in WASM
I am currently building a small project that outsources it's processing into wasm compiled from rust. I am using wasm-bindgen, wasm-pack and webpack. Shortly after the WASM is instantiated, I get the ...
0
votes
0
answers
236
views
How to send values bigger than i8 from JS through wasm-memory to Rust?
Currently I'm trying to send values bigger than i8 from JS through wasm-memory to Rust like so:
Rust:
// CREATE WASM MEMORY FOR RUST AND JS DIRECT USE.
const WASM_MEMORY_BUFFER_SIZE: usize = 2; // 2 ...
0
votes
1
answer
212
views
Production config Webpack build for a Rust, WebAssembly app to apache2 server
I have a Rust, Web assembly wasm app I need to deploy to an apache server. When upload the build, it doesn't run the software, it just shows a list of the files.
The build files look like this:
build
...
1
vote
0
answers
998
views
Instantiating & freeing a WASM module repeatedly causes "Memory Access out of bounds"
I'm using wasm-bindgen to build a simple Rust struct with constructor that takes a JS closure, and run it in node.js.
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct WasmThing {
func: ...
0
votes
1
answer
812
views
How can I create a wasm_bindgen Closure which captures a Rc<RefCell<_>> without moving out of it?
I have state that needs to be mutated multiple times by JavaScript callbacks (it's a game, so input from the user needs to modify the game state). I can't seem to figure out how to do it though. This ...
3
votes
0
answers
1k
views
How to return nested array from wasm_bindgen function
I have a rust program which I would like to run as web assembly in javascript. I have a function which I want to return a 3D array, so I can plot some data on a graph on the frontend, but I cannot ...