Comments (5)
I donno much about the range of wasm targets that exist, or what normally happens, but wasm was meant to be quite deterministic, and ours bans any form of real randomness or secrets. I'd assume that no_std wasm has basically nothing unless you'd some additional host interface that supplies it, but not really sure.
from getrandom.
This will get clarified w/ the 0.2
release (see #135). But the basic idea is:
getrandom
works perfectly fine onwasm32-unknown-emscripten
andwasm32-wasi
getrandom
does not automatically work onwasm32-unknown-unknown
- Enabling the
getrandom/js
cargo feature will make this target work - Enabling this feature essentially says "I assume I'm running in an enviornment w/ JavaScript". This includes:
- wasm-bindgen or stdweb toolchains
- Client-side (in Browser) or Node.js
- Enabling the
- There are no other Rust
wasm32
targets that I am aware of. If new ones are added, they would not automatically work, and a pull request to getrandom would be needed.
Comment either here or in the doc bug if the above seems unclear or incorrect.
from getrandom.
I believe the rust target is wasm32-unknown-unknown. If I read lib.rs correctly, wasm32-unknown-unknown without wasm32_bindgen or wasm32_stdweb compiles to dummy.rs, which always errors. This is correct behavior for "perfectly" deterministic wasm targets. I think this can be closed.
from getrandom.
Sounds good.
If I read lib.rs correctly, wasm32-unknown-unknown without wasm32_bindgen or wasm32_stdweb compiles to dummy.rs, which always errors. This is correct behavior for "perfectly" deterministic wasm targets. I think this can be closed.
This is correct for v0.1
. For v0.2
we are changing things so that getrandom
will not compile on unsupported targets (i.e. wasm32-unknown-unknown
without JavaScript). See lib.rs
on the 0.2
branch.
from getrandom.
I see, getrandom is already an optional dependency of rand_core and rand though, so this sounds good too.
from getrandom.
Related Issues (20)
- Cannot compile with rust 1.70 and x86_64-unknown-linux-musl target HOT 15
- Support for non-blocking getrandom HOT 2
- Hash pin github workflow dependencies HOT 4
- Constant `__getrandom_internal` should have UPPER_SNAKE_CASE name, e.g. `__GETRANDOM_INTERNAL`rust-analyzernon_upper_case_globals HOT 3
- What versions do platform support track? HOT 4
- Broken link to sys_read_entropy HOT 4
- Rust embedded standard library (no_std) target is not supported HOT 9
- Don't fall back to file I/O on Linux when Rust only supports kernels guaranteed to have it HOT 5
- Potential undefined behavior in hermit implementation. HOT 3
- Cannot use synchronous feature in node 18 HOT 7
- Add support for targets without atomic operations
- Support for UEFI HOT 3
- Failed to build for wasm32-unknown-unknown with no_std HOT 1
- Is the ESPIDF implementation actually correct? HOT 3
- Spurious failures of Web tests on Windows HOT 1
- Port from libc to rustix HOT 7
- Remove file-based RNG fallback on DragonflyBSD HOT 1
- man7 link should be replaced
- The newly updated version "0.2.13" cannot run on mipsel HOT 7
- Error: target is not supported (cargo build-bpf) 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 getrandom.