Questions tagged [rust-wasm]
121 questions
0
votes
1 answer
How do I make a continuous animation loop with wasm +winit?
I have the following rust code which work when I create a native window:
event_loop.run(move |event, _, control_flow| {
control_flow.set_poll();
match event {
Event::WindowEvent {
event:…

Pap113
- 37
- 1
- 7
0
votes
1 answer
Dioxus app failed to load - This is probably due to the Bindgen version, dioxus-cli using `0.2.81` Bindgen crate
I've decided to give Dioxus another shot.
This time, I tried launching a recently created Dioxus app, and got the following error:
[WARN] Config file: `Dioxus.toml` not found; using default config.
[WARN] Config file: `Dioxus.toml` not found; using…

Jose A
- 10,053
- 11
- 75
- 108
0
votes
0 answers
Rust WASM memory.buffer TypeError: Cannot read properties of undefined (reading 'buffer')
I'm learning wasm knowledge recently, and I want to use memory.buffer-related knowledge, but I can't run the content of this chapter smoothly:
https://rustwasm.github.io/wasm-bindgen/reference/types/pointers.html
Can anyone kindly help me get it up…

Jay
- 23
- 3
0
votes
0 answers
Twiggy command line options for emcc / emscripten to get meaningful data out
I'm using Twiggy from the Rust Wasm Toolchain to analyse a webassembly package to find largest contributors to code size.
Command line option
twiggy top -n 20 myWasm.wasm results in a table output like this:
Shallow Bytes │ Shallow % │…

Dr. Andrew Burnett-Thompson
- 20,980
- 8
- 88
- 178
0
votes
1 answer
rust wasm convert enum type to string without std or fmt
Is there a stable way to convert rust enum types to strings (and from strings to enum types) without the use of std or fmt?
The reason I am asking is because std appears to account for and 'bloat' the final binary size by around 33% (using cargo…

user1709076
- 2,538
- 9
- 38
- 59
0
votes
2 answers
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. I then want to export that function with the…

Reuben
- 39
- 9
0
votes
0 answers
Invalid route: insertion failed due to conflict with previously registered route: /_trunk/ws
hello I am experiencing this error when I try to execute trunk serve
Invalid route: insertion failed due to conflict with previously registered route: /_trunk/ws.
my trunk.toml file has the following contets:
[build]
target = "index.html"
release =…

collinsmarra
- 148
- 1
- 7
0
votes
0 answers
Failing to open websocket client connection on both wasm and native builds
I am building out my first Rust client/server application and struggling to get my client/server talking to each other over a websocket connection.
Any help would be highly appreciated!
Problem Overview
I am using axum with axum-login on the…

Bryan Reilly
- 114
- 4
0
votes
1 answer
Is there a way to configure "exit_on_all_closed" for browser tabs?
I'm currently working on understanding building Rust apps using Bevy in WebAssembly. Under normal circumstances, the exit_all_on_closed variable in the following code allows for the app to close when the window the app is launched in is closed.
fn…

tangoti84
- 45
- 6
0
votes
0 answers
Make DOM load in web_sys
How would I modify this to get the result below? The thing is there is no iterable. I am not sure what I am doing at this point as this code was AI generated. But my desired result it the js code snippet below.
use web_sys::{Element,…

collinsmarra
- 148
- 1
- 7
0
votes
1 answer
Leptos router gives a warning which I do not unterstand
I stared to experiment with https://github.com/gbj/leptos/ using the current main branch from Git. Following the router example I get the following warning in my console in the browser:
WARNING: You are providing a context of a…

Achim
- 15,415
- 15
- 80
- 144
0
votes
1 answer
How to run Wasm module with podman + crun?
I am trying to use podman to run a Wasm module as shown here, but I keep getting the error "Exec format error".
I have a Wasm module named "hellor.wasm" which executes correctly using both wasmer and wasmtime.
I am running podman on Rocky Linux…

Tony Iams
- 21
- 1
0
votes
1 answer
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 draw the graph).
Context
I want Rust/wasm to make…

Simon Crowe
- 301
- 3
- 14
0
votes
0 answers
Understanding wasm-bindgen returned objects memory management
I'm trying to return a typed object from Rust to Typescript, and I ideally don't want to have to manually manage memory (performance is not the highest priority). While doing this, I'm trying to understand the generated JS.
Rust:
#[wasm_bindgen]
pub…

User
- 31,811
- 40
- 131
- 232
0
votes
0 answers
unknown import: `wasi_snapshot_preview1::sock_setsockopt` has not been defined when running Rust WASI binary
Title says it all - I am attempting to run a very basic Rust program using hyper_wasi, and everything compiles seemingly ok using cargo wasi run. Unfortunately when it actually executes, I get:
Error: failed to run main module…

Chris Shain
- 50,833
- 6
- 93
- 125