29 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
186
views
How should I structure this websocket-based WASM app?
I'm trying to build a frontend application using rust wasm and a websocket to connect to the server. Here's the desired core logic:
Server (axum) needs to send a command to the app
Server creates an ...
3
votes
1
answer
91
views
What does `.map_err(|_| ())` do in this web-sys canvas example?
I'm reading through the canvas hello world example in the wasm-bindgen docs, and I'm confused about this part of the code:
#[wasm_bindgen(start)]
fn start() {
let document = web_sys::window()....
2
votes
1
answer
320
views
Rust WASM code stalls on awaiting web_sys::Window.fetch_with_request
I am trying to use the Fetch API using web_sys in Rust WASM code. I have defined an async function:
#[wasm_bindgen]
pub async fn fetch_as_vec_u8(resource_name: &str) -> Result<Vec<u8>, ...
0
votes
0
answers
154
views
Rustwasm (web_sys) vs Javascript: canvas2d performance issue
I'm now creating a html5 canvas2d based game (using Wasm - Rust)
and I'm using web_sys to draw things to canvas from Rust side.
The execution performance is very important for me.
I tested the ...
0
votes
0
answers
41
views
How do I create the input argument "Object" for read_with_array_buffer_view(&obj)?
In this case I am trying to read a small utf8 text file ( < 4k ), which I eventually want to move into a String.
let dref = jval.dyn_ref::<ReadableStreamByobReader>();
let byob_reader = dref....
0
votes
1
answer
151
views
How does one get typed objects or references from js_sys::Objects, and contained wasm_bindgen::JsValues in Rust
I'm trying to get some data out of a ReadableStream I have this Rust code where I'm trying to handle a drop from the desktop on a Mac. I started with a DataTransfer to get to here.
let stream: ...
0
votes
1
answer
110
views
problem in window().set_timeout_with_callback_and_timeout_and_arguments_0 , how to setTimeout in rust-wasm correctly?
I am building a snake game in web assembly, after lot of code commenting and un-commenting, i am seeing where it is giving me error, its giving me error in window()....
0
votes
1
answer
128
views
How can I get on:paste to work with `web_sys`?
For the project I want the verification code part of the sign up stepper to have each number separated into small boxes and when pasted the code will be pasted into each individual box. The problem is ...
0
votes
1
answer
414
views
Cargo doesn't build winit with nokhwa bc of web-sys dependency
I have a winit crate based Rust project, to which I want to add the nokhwa crate too, but now cargo doesn't even compile it, because of some weird dependency error:
error: failed to select a version ...
1
vote
1
answer
548
views
No click method defined on element when created via web_sys
In the JavaScript console, I can execute the following to create an <input> element and demonstrate that it has a click method.
let input = document.createElement("input");
input.type =...
0
votes
1
answer
232
views
Is there any way to cast a Callback<MouseEvent> into FnMut(MouseEvent)?
I'm implementing material 3 from scratch with web_sys and writing some adapters for different frameworks among them yew.
I have implemented a basic structure for buttons something like this to use ...
1
vote
1
answer
128
views
How to `animate` an object using web-sys and js-sys
I've been trying to emulate this javascript code in a frontend framework and haven't been able to get much traction.
window.onpointermove = event => {
const { clientX, clientY } = event;
...
-1
votes
1
answer
567
views
How to add an event listener to some HTML element from Rust which calls a trivial JS function?
I have the "on_event" JS function:
function on_event(event) {
console.log(event);
}
And I have the "button" HTML element builder in Rust:
let window = web_sys::window().expect(...
2
votes
1
answer
916
views
Bevy - Render to wgpu::Texture
I am looking for an elegant and hopefully bevy-esque way of rendering to a wgpu::Texture. The reason is that I'm am implementing a WebXR libary and the WebXRFramebuffer must be rendered to in ...
2
votes
0
answers
630
views
How to pass 64 bit float uniform to webgl shaders from wasm?
I'm currently attempting to interface with a webgl2 canvas from a WASM program using wasm_bindgen and the web_sys crate. I am passing two vectors into my fragment shader as uniforms however I cant ...