fixing random for wasm

This commit is contained in:
Andy Pack 2025-02-14 23:47:51 +00:00
parent 43450bfbcb
commit 26479b96d7
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
5 changed files with 8 additions and 6 deletions
.gitea/workflows
Cargo.lock
finlib-wasm
finlib

@ -46,11 +46,6 @@ jobs:
with:
toolchain: stable
- name: Cargo Build
uses: actions-rs/cargo@v1
with:
command: build
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

3
Cargo.lock generated

@ -250,6 +250,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
name = "finlib"
version = "0.0.1"
dependencies = [
"getrandom 0.2.15",
"log",
"nalgebra",
"ndarray",
@ -285,8 +286,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasm-bindgen",
]
[[package]]

@ -0,0 +1,2 @@
[build]
rustflags = ['--cfg=getrandom_backend="wasm_js"']

@ -12,7 +12,7 @@ default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.100"
finlib = { path = "../finlib" }
finlib = { path = "../finlib", features = ["wasm"] }
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires

@ -12,7 +12,9 @@ ndarray-stats = { workspace = true }
nalgebra = { workspace = true }
statrs = { workspace = true }
log = { workspace = true }
getrandom = "*"
[features]
py = ["dep:pyo3"]
wasm = ["getrandom/js"]
parallel = ["dep:rayon"]