Disable std feature by default in rand_core and rand_jitter
Implements #702 Resolves #645
This commit is contained in:
+3
-3
@@ -46,9 +46,9 @@ members = [
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "rand_core", version = "0.3", default-features = false }
|
||||
rand_core = { path = "rand_core", version = "0.4" }
|
||||
rand_pcg = { path = "rand_pcg", version = "0.1" }
|
||||
rand_jitter = { path = "rand_jitter", version = "0.1", default-features = false }
|
||||
rand_jitter = { path = "rand_jitter", version = "0.1" }
|
||||
rand_os = { path = "rand_os", version = "0.1", optional = true }
|
||||
# only for deprecations and benches:
|
||||
rand_isaac = { path = "rand_isaac", version = "0.1" }
|
||||
@@ -84,4 +84,4 @@ autocfg = "0.1"
|
||||
all-features = true
|
||||
|
||||
[patch.crates-io]
|
||||
rand_core = { path = "rand_core", version = "0.3", default-features = false }
|
||||
rand_core = { path = "rand_core", version = "0.4" }
|
||||
|
||||
@@ -19,7 +19,7 @@ travis-ci = { repository = "rust-random/rand" }
|
||||
appveyor = { repository = "rust-random/rand" }
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
|
||||
[build-dependencies]
|
||||
autocfg = "0.1"
|
||||
|
||||
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.4.0] - 2019-01-24
|
||||
- Disable the `std` feature by default (#702)
|
||||
|
||||
## [0.3.0] - 2018-09-24
|
||||
- Add `SeedableRng::seed_from_u64` for convenient seeding. (#537)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rand_core"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
authors = ["The Rand Project Developers", "The Rust Project Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
@@ -18,7 +18,6 @@ travis-ci = { repository = "rust-random/rand" }
|
||||
appveyor = { repository = "rust-random/rand" }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["alloc"] # use std library; should be default but for above bug
|
||||
alloc = [] # enables Vec and Box support without std
|
||||
serde1 = ["serde", "serde_derive"] # enables serde for BlockRng wrapper
|
||||
|
||||
+6
-5
@@ -44,13 +44,14 @@ The traits and error types are also available via `rand`.
|
||||
|
||||
`rand_core` supports `no_std` and `alloc`-only configurations, as well as full
|
||||
`std` functionality. The differences between `no_std` and full `std` are small,
|
||||
comprising `RngCore` support for `Box<R>` types where `R: RngCore`, as well as
|
||||
comprising `RngCore` support for `Box<R>` types where `R: RngCore`,
|
||||
`std::io::Read` support for types supporting `RngCore`, and
|
||||
extensions to the `Error` type's functionality.
|
||||
|
||||
Due to [rust-lang/cargo#1596](https://github.com/rust-lang/cargo/issues/1596),
|
||||
`rand_core` is built without `std` support by default. Since features are
|
||||
unioned across the whole dependency tree, any crate using `rand` with its
|
||||
default features will also enable `std` support in `rand_core`.
|
||||
The `std` feature is *not enabled by default*. This is primarily to avoid build
|
||||
problems where one crate implicitly requires `rand_core` with `std` support and
|
||||
another crate requires `rand` *without* `std` support. However, the `rand` crate
|
||||
continues to enable `std` support by default, both for itself and `rand_core`.
|
||||
|
||||
The `serde1` feature can be used to derive `Serialize` and `Deserialize` for RNG
|
||||
implementations that use the `BlockRng` or `BlockRng64` wrappers.
|
||||
|
||||
+1
-1
@@ -18,4 +18,4 @@ travis-ci = { repository = "rust-random/rand" }
|
||||
appveyor = { repository = "rust-random/rand" }
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
|
||||
@@ -21,7 +21,7 @@ appveyor = { repository = "rust-random/rand" }
|
||||
serde1 = ["serde", "serde_derive", "rand_core/serde1"]
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
serde = { version = "1", optional = true }
|
||||
serde_derive = { version = "^1.0.38", optional = true }
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.0] - 2019-01-04
|
||||
## [0.1.0] - 2019-01-24
|
||||
Initial release.
|
||||
|
||||
@@ -14,7 +14,7 @@ travis-ci = { repository = "rust-random/rand" }
|
||||
appveyor = { repository = "rust-random/rand" }
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = "0.3", default-features = false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
log = { version = "0.4", optional = true }
|
||||
|
||||
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
|
||||
@@ -24,6 +24,4 @@ libc = "0.2"
|
||||
winapi = { version = "0.3", features = ["profileapi"] }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
|
||||
std = ["rand_core/std"]
|
||||
|
||||
@@ -22,6 +22,12 @@ Links:
|
||||
- [API documentation (docs.rs)](https://docs.rs/rand_jitter)
|
||||
- [Changelog](CHANGELOG.md)
|
||||
|
||||
## Features
|
||||
|
||||
This crate has optional `std` support which is *disabled by default*;
|
||||
this feature is required to provide the `JitterRng::new` function;
|
||||
without `std` support a timer must be supplied via `JitterRng::new_with_timer`.
|
||||
|
||||
## Quality testing
|
||||
|
||||
`JitterRng::new()` has build-in, but limited, quality testing, however
|
||||
|
||||
@@ -2,8 +2,10 @@ extern crate rand_jitter;
|
||||
extern crate rand_core;
|
||||
|
||||
use rand_jitter::JitterRng;
|
||||
#[cfg(feature = "std")]
|
||||
use rand_core::RngCore;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[test]
|
||||
fn test_jitter_init() {
|
||||
// Because this is a debug build, measurements here are not representive
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ travis-ci = { repository = "rust-random/rand" }
|
||||
appveyor = { repository = "rust-random/rand" }
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = "0.3", default-features = false }
|
||||
rand_core = { path = "../rand_core", version = "0.4", features = ["std"] }
|
||||
log = { version = "0.4", optional = true }
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ appveyor = { repository = "rust-random/rand" }
|
||||
serde1 = ["serde", "serde_derive"]
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
serde = { version = "1", optional = true }
|
||||
serde_derive = { version = "^1.0.38", optional = true }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ appveyor = { repository = "rust-random/rand" }
|
||||
serde1 = ["serde", "serde_derive"]
|
||||
|
||||
[dependencies]
|
||||
rand_core = { path = "../rand_core", version = ">=0.2, <0.4", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
serde = { version = "1", optional = true }
|
||||
serde_derive = { version = "^1.0.38", optional = true }
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ categories = ["algorithms"]
|
||||
|
||||
[dependencies]
|
||||
byteorder = { version = "1", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.3", default-features=false }
|
||||
rand_core = { path = "../rand_core", version = "0.4" }
|
||||
|
||||
[dev-dependencies]
|
||||
rand = { path = "..", version = "0.6", default-features=false } # needed for doctests
|
||||
|
||||
Reference in New Issue
Block a user