Skip to content

Commit 0128160

Browse files
committed
Rename thread-rng to rand_trng
1 parent 52fe278 commit 0128160

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ features = ["small_rng", "serde"]
2828

2929
[features]
3030
# Meta-features:
31-
default = ["std", "std_rng", "getrandom", "small_rng", "thread-rng"]
31+
default = ["std", "std_rng", "getrandom", "small_rng", "thread_rng"]
3232
nightly = [] # some additions requiring nightly Rust
3333
serde = ["dep:serde", "rand_core/serde"]
3434

@@ -45,6 +45,9 @@ getrandom = ["rand_core/getrandom"]
4545
# Option (requires nightly Rust): experimental SIMD support
4646
simd_support = ["zerocopy/simd-nightly"]
4747

48+
# Option (enabled by default): enable ThreadRng
49+
thread_rng = ["rand_trng", "std"]
50+
4851
# Option (enabled by default): enable StdRng
4952
std_rng = ["dep:rand_chacha"]
5053

@@ -65,15 +68,15 @@ members = [
6568
"rand_distr",
6669
"rand_chacha",
6770
"rand_pcg",
68-
"thread-rng",
71+
"rand_trng",
6972
]
7073
exclude = ["benches"]
7174

7275
[dependencies]
7376
rand_core = { path = "rand_core", version = "=0.9.0-alpha.1", default-features = false }
7477
log = { version = "0.4.4", optional = true }
7578
serde = { version = "1.0.103", features = ["derive"], optional = true }
76-
thread-rng = { version = "0.1.0", path = "thread-rng", optional = true }
79+
rand_trng = { version = "0.1.0", path = "rand_trng", optional = true }
7780
rand_chacha = { path = "rand_chacha", version = "=0.9.0-alpha.1", default-features = false, optional = true }
7881
zerocopy = { version = "0.8.0", default-features = false, features = ["simd"] }
7982

thread-rng/Cargo.toml renamed to rand_trng/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "thread-rng"
2+
name = "rand_trng"
33
version = "0.1.0"
44
authors = ["The Rand Project Developers"]
55
license = "MIT OR Apache-2.0"
File renamed without changes.
File renamed without changes.

thread-rng/README.md renamed to rand_trng/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# thread-rng: lazily-initialized thread-local random number generator
1+
# rand_trng: lazily-initialized thread-local random number generator
22

33
[![Test Status](https://github.com/rust-random/rand/workflows/Tests/badge.svg?event=push)](https://github.com/rust-random/rand/actions)
4-
[![Latest version](https://img.shields.io/crates/v/thread-rng.svg)](https://crates.io/crates/thread-rng)
4+
[![Latest version](https://img.shields.io/crates/v/rand_trng.svg)](https://crates.io/crates/rand_trng)
55
[![Book](https://img.shields.io/badge/book-master-yellow.svg)](https://rust-random.github.io/book/)
6-
[![API](https://img.shields.io/badge/api-master-yellow.svg)](https://rust-random.github.io/rand/thread-rng)
7-
[![API](https://docs.rs/thread-rng/badge.svg)](https://docs.rs/thread-rng)
6+
[![API](https://docs.rs/rand_trng/badge.svg)](https://docs.rs/rand_trng)
87

98
## License
109

File renamed without changes.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub use crate::rngs::thread::rng;
109109
/// Access the thread-local generator
110110
///
111111
/// Use [`rand::rng()`](rng()) instead.
112-
#[cfg(all(feature = "std", feature = "std_rng", feature = "getrandom"))]
112+
#[cfg(feature = "thread_rng")]
113113
#[deprecated(since = "0.9.0", note = "renamed to `rng`")]
114114
#[inline]
115115
pub fn thread_rng() -> crate::rngs::ThreadRng {

src/rngs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub(crate) mod thread;
102102
pub use self::small::SmallRng;
103103
#[cfg(feature = "std_rng")]
104104
pub use self::std::StdRng;
105-
#[cfg(feature = "thread-rng")]
105+
#[cfg(feature = "thread_rng")]
106106
pub use self::thread::ThreadRng;
107107

108108
#[cfg(feature = "getrandom")]

src/rngs/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
//! Thread-local random number generator
1010
11-
pub use thread_rng::ThreadRng;
11+
pub use rand_trng::ThreadRng;
1212

1313
/// Access a fast, pre-initialized generator
1414
///
@@ -39,5 +39,5 @@ pub use thread_rng::ThreadRng;
3939
///
4040
/// Refer to [`ThreadRng#Security`].
4141
pub fn rng() -> ThreadRng {
42-
thread_rng::rng()
42+
rand_trng::rng()
4343
}

0 commit comments

Comments
 (0)