Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable std by default #95

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ matrix:
- cargo build --target=x86_64-unknown-netbsd
# - cargo build --target=x86_64-unknown-redox
- cargo build --target=x86_64-fortanix-unknown-sgx
- cargo xbuild --target=x86_64-unknown-uefi
- cargo xbuild --target=x86_64-unknown-hermit
- cargo xbuild --target=x86_64-unknown-l4re-uclibc
- cargo xbuild --target=x86_64-unknown-uefi --no-default-features
- cargo xbuild --target=x86_64-unknown-hermit --no-default-features
- cargo xbuild --target=x86_64-unknown-l4re-uclibc --no-default-features
- cargo xbuild --target=x86_64-uwp-windows-gnu --no-default-features
# also test minimum dependency versions are usable
- cargo generate-lockfile -Z minimal-versions
- cargo build --target=x86_64-sun-solaris
Expand All @@ -128,10 +129,10 @@ matrix:
- cargo build --target=x86_64-unknown-netbsd
# - cargo build --target=x86_64-unknown-redox
- cargo build --target=x86_64-fortanix-unknown-sgx
- cargo xbuild --target=x86_64-unknown-uefi
- cargo xbuild --target=x86_64-unknown-hermit
- cargo xbuild --target=x86_64-unknown-l4re-uclibc
- cargo xbuild --target=x86_64-uwp-windows-gnu
- cargo xbuild --target=x86_64-unknown-uefi --no-default-features
- cargo xbuild --target=x86_64-unknown-hermit --no-default-features
- cargo xbuild --target=x86_64-unknown-l4re-uclibc --no-default-features
- cargo xbuild --target=x86_64-uwp-windows-gnu --no-default-features

# Trust cross-built/emulated targets. We must repeat all non-default values.
- name: "Linux (MIPS, big-endian)"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ wasm-bindgen = { version = "0.2.29", optional = true }
stdweb = { version = "0.4.18", optional = true }

[features]
default = ["std"]
std = []
# enables dummy implementation for unsupported targets
dummy = []
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ fn get_random_buf() -> Result<[u8; 32], getrandom::Error> {

## Features

This library is `no_std` for every supported target. However, getting randomness
By default, the `std` feature is enabled, allowing getrandom's
[`Error`](https://docs.rs/getrandom/0.1.10/getrandom/struct.Error.html)
to implement traits like
[`std::error::Error`](https://doc.rust-lang.org/std/error/trait.Error.html). To
use getrandom in a `no_std` environment, the `std` feature must be disabled by
setting `default-features = false` in `Cargo.toml`. Without this feature, this
library is `no_std` for every supported target.

However, getting randomness
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting a paragraph with however is never good grammar...

usually requires calling some external system API. This means most platforms
will require linking against system libraries (i.e. `libc` for Unix,
`Advapi32.dll` for Windows, Security framework on iOS, etc...).
Expand Down