Comments (2)
This indicates a runtime error in your Rust code. Can you post a gist of your lib.rs file?
from wasm-learning.
Thanks for the reply :)
I just noticed that I'd somehow missed the first two lines, so mine was
#[wasm_bindgen] pub fn solve(params: &str) -> String { let ps: (f32, f32, f32) = serde_json::from_str(¶ms).unwrap(); let discriminant: f32 = (ps.1 * ps.1) - (4. * ps.0 * ps.2); let mut solution: (f32, f32) = (0., 0.); if discriminant >= 0. { solution.0 = (((-1.) * ps.1) + discriminant.sqrt()) / (2. * ps.0); solution.1 = (((-1.) * ps.1) - discriminant.sqrt()) / (2. * ps.0); return serde_json::to_string(&solution).unwrap(); } else { return String::from("not real numbers"); } }
but I've just changed it to include the missing lines. Using VS on Windows 10 or Ubuntu 20.04 still gives the error above.
I'm pretty much brand new to this, so there's a good chance that I've got something basic wrong. At the beginning of the Getting started with Rust functions in Node.js article I used the git clone https://github.com/second-state/ssvm-nodejs-starter
command to get the files, so tried the same with the quadratic equation example, but it wouldn't work. Googling told me to go to the root, so wasm-learning, and use git clone there. I've then gone to the nodejs/quadratic/ folder and worked from there, including telling VS to open it in the terminal. As far as I can tell, everything has run from that folder.
from wasm-learning.
Related Issues (14)
- issue HOT 2
- issue2 HOT 1
- Issue running npm express on docker WSL 2
- ocr issue HOT 1
- Issue while building the quadratic project. HOT 1
- Live demoes not working HOT 12
- Update new TensorFlow API
- Run nodejs example with c api HOT 3
- Add `rustup target add wasm32-wasi` into the `wasm-learning/cli/hello/` example HOT 2
- Do we have yolov4-tflite result parse code? HOT 3
- Fails to compile with go run but succeeds with go build HOT 3
- Why .\wasmedge.exe --reactor .\add.wasm add -10 1 results in 4294967287?
- Issue while building the wasm bytecode HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm-learning.