Skip to content

Commit

Permalink
Merge pull request #327 from pitdicker/rand_core_rename
Browse files Browse the repository at this point in the history
Rename rand-core to rand_core
  • Loading branch information
dhardy authored Mar 23, 2018
2 parents 57163f6 + d37d8d1 commit 717f785
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 30 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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).

A [separate changelog is kept for rand-core](rand-core/CHANGELOG.md).
A [separate changelog is kept for rand_core](rand_core/CHANGELOG.md).

You may also find the [Update Guide](UPDATING.md) useful.

Expand All @@ -13,7 +13,7 @@ You may also find the [Update Guide](UPDATING.md) useful.

### Crate features and organisation
- Minimum Rust version update: 1.22.0. (#239)
- Create a seperate `rand-core` crate. (#288)
- Create a seperate `rand_core` crate. (#288)
- Deprecate `rand_derive`. (#256)
- Add `log` feature. Logging is now available in `JitterRng`, `OsRng`, `EntropyRng` and `ReseedingRng`. (#246)
- Add `serde-1` feature for some PRNGs. (#189)
Expand All @@ -29,9 +29,9 @@ You may also find the [Update Guide](UPDATING.md) useful.
- Deprecate `Rng::gen_iter`. (#286)
- Deprecate `Rng::gen_ascii_chars`. (#279)

### `rand-core` crate
### `rand_core` crate
(changes included here because they greatly influence the Rand crate)
- `RngCore` and `SeedableRng` are now part of `rand-core`. (#288)
- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288)
- Add modules to help implementing RNGs `impl` and `le`. (#209, #228)
- Add `Error` and `ErrorKind`. (#225)
- Add `CryptoRng` marker trait. (#273)
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ categories = ["algorithms"]
default = ["std"]
nightly = ["i128_support"] # enables all features requiring nightly rust

std = ["rand-core/std", "winapi", "libc"] # default feature; without this rand uses libcore
alloc = ["rand-core/alloc"] # enables Vec and Box support without std
std = ["rand_core/std", "winapi", "libc"] # default feature; without this rand uses libcore
alloc = ["rand_core/alloc"] # enables Vec and Box support without std

i128_support = [] # enables i128 and u128 support

Expand All @@ -32,15 +32,15 @@ libc = { version = "0.2", optional = true }
winapi = { version = "0.3", features = ["minwindef", "ntsecapi", "profileapi", "winnt"], optional = true }

[dependencies]
rand-core = { path = 'rand-core', default-features = false }
rand_core = { path = 'rand_core', default-features = false }

log = { version = "0.4", optional = true }

serde = {version="1",optional=true}
serde_derive = {version="1", optional=true}

[workspace]
members = ["rand-core"]
members = ["rand_core"]

[dev-dependencies]
# This is for testing serde, unfortunately
Expand Down
10 changes: 5 additions & 5 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ This release also contains many optimisations, which are not detailed below.

### Crates

We have a new crate: `rand-core`! This crate houses some important traits,
We have a new crate: `rand_core`! This crate houses some important traits,
`RngCore`, `BlockRngCore`, `SeedableRng` and `CryptoRng`, the error types, as
well as two modules with helpers for implementations: `le` and `impls`. It is
recommended that implementations of generators use the `rand-core` trait while
other users use only the `rand` crate, which re-exports most parts of `rand-core`.
recommended that implementations of generators use the `rand_core` trait while
other users use only the `rand` crate, which re-exports most parts of `rand_core`.

The `rand_derive` crate has been deprecated due to very low usage and
deprecation of `Rand`.
Expand All @@ -36,7 +36,7 @@ Several new Cargo feature flags have been added:
by generators) and a "front end" `Rng` implementing all the convenient extension
methods.

Implementations of generators must `impl RngCore` instead. Usage of `rand-core`
Implementations of generators must `impl RngCore` instead. Usage of `rand_core`
for implementations is encouraged; the `rand_core::{le, impls}` modules may
prove useful.

Expand Down Expand Up @@ -109,7 +109,7 @@ Endianness. Helper functions are available in `rand_core::le` to read `u32` and

#### Block-based PRNGs

rand-core has a new helper trait, `BlockRngCore`, and implementation,
rand_core has a new helper trait, `BlockRngCore`, and implementation,
`BlockRng`. These are for use by generators which generate a block of random
data at a time instead of word-sized values. Using this trait and implementation
has two advantages: optimised `RngCore` methods are provided, and the PRNG can
Expand Down
6 changes: 2 additions & 4 deletions rand-core/CHANGELOG.md → rand_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0


## [0.1.0] - Unreleased

### `rand-core` crate
(Split out of the Rand crate, changes here are relative to rand 0.4.2)
- `RngCore` and `SeedableRng` are now part of `rand-core`. (#288)
- `RngCore` and `SeedableRng` are now part of `rand_core`. (#288)
- Add modules to help implementing RNGs `impl` and `le`. (#209, #228)
- Add `Error` and `ErrorKind`. (#225)
- Add `CryptoRng` marker trait. (#273)
Expand All @@ -19,5 +17,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Remove default implementations for `RngCore::next_u64` and `RngCore::fill_bytes`. (#288)
- Add `RngCore::try_fill_bytes`. (#225)

## [0.0.1] - 2017-09-14
## [0.0.1] - 2017-09-14 (yanked)
Experimental version as part of the rand crate refactor.
6 changes: 3 additions & 3 deletions rand-core/Cargo.toml → rand_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "rand-core"
name = "rand_core"
version = "0.1.0-pre.0"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang-nursery/rand"
documentation = "https://docs.rs/rand-core"
homepage = "https://crates.io/crates/rand-core"
documentation = "https://docs.rs/rand_core"
homepage = "https://crates.io/crates/rand_core"
description = """
Core random number generator traits and tools for implementation.
"""
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions rand-core/README.md → rand_core/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rand-core
rand_core
====

Core traits and error types of the [rand] library, plus tools for implementing
Expand All @@ -14,7 +14,7 @@ applications (including sampling from restricted ranges, conversion to floating
point, list permutations and secure initialisation of RNGs). Most users should
prefer to use the main [rand] crate.

[Documentation](https://docs.rs/rand-core)
[Documentation](https://docs.rs/rand_core)

[rand]: ../README.md

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion rand-core/src/lib.rs → rand_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
html_root_url = "https://docs.rs/rand-core/0.1")]
html_root_url = "https://docs.rs/rand_core/0.1")]

#![deny(missing_debug_implementations)]

Expand Down
14 changes: 7 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ extern crate rand_core;

use core::{marker, mem, slice};

// re-exports from rand-core
// re-exports from rand_core
pub use rand_core::{RngCore, BlockRngCore, CryptoRng, SeedableRng};
pub use rand_core::{ErrorKind, Error};

Expand Down Expand Up @@ -391,7 +391,7 @@ pub trait Rand : Sized {
/// }
/// ```
///
/// [`RngCore`]: https://docs.rs/rand-core/0.1/rand-core/trait.RngCore.html
/// [`RngCore`]: https://docs.rs/rand_core/0.1/rand_core/trait.RngCore.html
pub trait Rng: RngCore {
/// Fill `dest` entirely with random bytes (uniform value distribution),
/// where `dest` is any type supporting [`AsByteSliceMut`], namely slices
Expand All @@ -413,7 +413,7 @@ pub trait Rng: RngCore {
/// thread_rng().try_fill(&mut arr[..]);
/// ```
///
/// [`fill_bytes`]: https://docs.rs/rand-core/0.1/rand-core/trait.RngCore.html#method.fill_bytes
/// [`fill_bytes`]: https://docs.rs/rand_core/0.1/rand_core/trait.RngCore.html#method.fill_bytes
/// [`try_fill`]: trait.Rng.html#method.try_fill
/// [`AsByteSliceMut`]: trait.AsByteSliceMut.html
fn fill<T: AsByteSliceMut + ?Sized>(&mut self, dest: &mut T) {
Expand Down Expand Up @@ -448,8 +448,8 @@ pub trait Rng: RngCore {
/// # try_inner().unwrap()
/// ```
///
/// [`ErrorKind`]: https://docs.rs/rand-core/0.1/rand-core/enum.ErrorKind.html
/// [`try_fill_bytes`]: https://docs.rs/rand-core/0.1/rand-core/trait.RngCore.html#method.try_fill_bytes
/// [`ErrorKind`]: https://docs.rs/rand_core/0.1/rand_core/enum.ErrorKind.html
/// [`try_fill_bytes`]: https://docs.rs/rand_core/0.1/rand_core/trait.RngCore.html#method.try_fill_bytes
/// [`fill`]: trait.Rng.html#method.fill
/// [`AsByteSliceMut`]: trait.AsByteSliceMut.html
fn try_fill<T: AsByteSliceMut + ?Sized>(&mut self, dest: &mut T) -> Result<(), Error> {
Expand Down Expand Up @@ -803,8 +803,8 @@ impl<R: RngCore> Iterator for AsciiGenerator<R> {
/// println!("Random die roll: {}", rng.gen_range(1, 7));
/// ```
///
/// [`SeedableRng`]: https://docs.rs/rand-core/0.1/rand-core/trait.SeedableRng.html
/// [`SeedableRng::from_seed`]: https://docs.rs/rand-core/0.1/rand-core/trait.SeedableRng.html#tymethod.from_seed
/// [`SeedableRng`]: https://docs.rs/rand_core/0.1/rand_core/trait.SeedableRng.html
/// [`SeedableRng::from_seed`]: https://docs.rs/rand_core/0.1/rand_core/trait.SeedableRng.html#tymethod.from_seed
#[cfg(feature="std")]
pub trait NewRng: SeedableRng {
/// Creates a new instance, automatically seeded with fresh entropy.
Expand Down

0 comments on commit 717f785

Please sign in to comment.