From d37d8d1c0edfb95a88eb86e486f0fb1196196249 Mon Sep 17 00:00:00 2001 From: Paul Dicker Date: Fri, 23 Mar 2018 13:33:34 +0100 Subject: [PATCH] Rename rand-core to rand_core --- CHANGELOG.md | 8 ++++---- Cargo.toml | 8 ++++---- UPDATING.md | 10 +++++----- {rand-core => rand_core}/CHANGELOG.md | 6 ++---- {rand-core => rand_core}/Cargo.toml | 6 +++--- {rand-core => rand_core}/LICENSE-APACHE | 0 {rand-core => rand_core}/LICENSE-MIT | 0 {rand-core => rand_core}/README.md | 4 ++-- {rand-core => rand_core}/src/error.rs | 0 {rand-core => rand_core}/src/impls.rs | 0 {rand-core => rand_core}/src/le.rs | 0 {rand-core => rand_core}/src/lib.rs | 2 +- src/lib.rs | 14 +++++++------- 13 files changed, 28 insertions(+), 30 deletions(-) rename {rand-core => rand_core}/CHANGELOG.md (88%) rename {rand-core => rand_core}/Cargo.toml (82%) rename {rand-core => rand_core}/LICENSE-APACHE (100%) rename {rand-core => rand_core}/LICENSE-MIT (100%) rename {rand-core => rand_core}/README.md (94%) rename {rand-core => rand_core}/src/error.rs (100%) rename {rand-core => rand_core}/src/impls.rs (100%) rename {rand-core => rand_core}/src/le.rs (100%) rename {rand-core => rand_core}/src/lib.rs (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f748e60193..2c03338274d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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) @@ -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) diff --git a/Cargo.toml b/Cargo.toml index e75b9e30f91..371a596fd87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 @@ -32,7 +32,7 @@ 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 } @@ -40,7 +40,7 @@ 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 diff --git a/UPDATING.md b/UPDATING.md index 6f02807dc31..967814b3ab2 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -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`. @@ -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. @@ -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 diff --git a/rand-core/CHANGELOG.md b/rand_core/CHANGELOG.md similarity index 88% rename from rand-core/CHANGELOG.md rename to rand_core/CHANGELOG.md index f41b9bba2e3..e52cfcbecb8 100644 --- a/rand-core/CHANGELOG.md +++ b/rand_core/CHANGELOG.md @@ -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) @@ -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. diff --git a/rand-core/Cargo.toml b/rand_core/Cargo.toml similarity index 82% rename from rand-core/Cargo.toml rename to rand_core/Cargo.toml index ba748f0a11e..57cf5e3c080 100644 --- a/rand-core/Cargo.toml +++ b/rand_core/Cargo.toml @@ -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. """ diff --git a/rand-core/LICENSE-APACHE b/rand_core/LICENSE-APACHE similarity index 100% rename from rand-core/LICENSE-APACHE rename to rand_core/LICENSE-APACHE diff --git a/rand-core/LICENSE-MIT b/rand_core/LICENSE-MIT similarity index 100% rename from rand-core/LICENSE-MIT rename to rand_core/LICENSE-MIT diff --git a/rand-core/README.md b/rand_core/README.md similarity index 94% rename from rand-core/README.md rename to rand_core/README.md index 20823d1f37f..34c92b65684 100644 --- a/rand-core/README.md +++ b/rand_core/README.md @@ -1,4 +1,4 @@ -rand-core +rand_core ==== Core traits and error types of the [rand] library, plus tools for implementing @@ -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 diff --git a/rand-core/src/error.rs b/rand_core/src/error.rs similarity index 100% rename from rand-core/src/error.rs rename to rand_core/src/error.rs diff --git a/rand-core/src/impls.rs b/rand_core/src/impls.rs similarity index 100% rename from rand-core/src/impls.rs rename to rand_core/src/impls.rs diff --git a/rand-core/src/le.rs b/rand_core/src/le.rs similarity index 100% rename from rand-core/src/le.rs rename to rand_core/src/le.rs diff --git a/rand-core/src/lib.rs b/rand_core/src/lib.rs similarity index 99% rename from rand-core/src/lib.rs rename to rand_core/src/lib.rs index e11b3e7b985..2dd200f2f1a 100644 --- a/rand-core/src/lib.rs +++ b/rand_core/src/lib.rs @@ -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)] diff --git a/src/lib.rs b/src/lib.rs index 37ef5f27129..08ea352f656 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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}; @@ -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 @@ -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(&mut self, dest: &mut T) { @@ -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(&mut self, dest: &mut T) -> Result<(), Error> { @@ -803,8 +803,8 @@ impl Iterator for AsciiGenerator { /// 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.