diff --git a/book.toml b/book.toml index c55ccb3..12bfb12 100644 --- a/book.toml +++ b/book.toml @@ -1,12 +1,14 @@ [book] authors = ["The Rand Project Developers"] -multilingual = false -src = "src" title = "The Rust Rand Book" description = "Extended documentation for Rust's Rand lib" +language = "en" -[output.html.playgen] +[rust] +edition = "2024" + +[output.html.playground] editable = true -[output.linkcheck] +# [output.linkcheck] # NOTE: this requires https://github.com/Michael-F-Bryan/mdbook-linkcheck diff --git a/src/guide-dist.md b/src/guide-dist.md index 232a691..d620fb1 100644 --- a/src/guide-dist.md +++ b/src/guide-dist.md @@ -93,7 +93,7 @@ Lets go over the distributions by type: support requires using the `simd_support` feature flag and nightly `rustc`. - For enums, you have to implement uniform sampling yourself. For example, you could use the following approach: - ```rust + ```rust,noplayground # use rand::{Rng, distr::{Distribution, StandardUniform}}; pub enum Food { Burger, diff --git a/src/guide-test-fn-rng.md b/src/guide-test-fn-rng.md index 13cde22..a480366 100644 --- a/src/guide-test-fn-rng.md +++ b/src/guide-test-fn-rng.md @@ -43,7 +43,7 @@ fn main() { To test this, we can create a `MockCryptoRng` implementing `TryRngCore` and `TryCryptoRng` in our testing module. Note that `MockCryptoRng` is private and `#[cfg(test)] mod tests` is cfg-gated to our test environment, thus ensuring that `MockCryptoRng` cannot accidentally be used in production. -```rust +```rust,noplayground #[cfg(test)] mod tests { use super::*; diff --git a/src/update-0.5.md b/src/update-0.5.md index 6b94753..0924ab4 100644 --- a/src/update-0.5.md +++ b/src/update-0.5.md @@ -74,7 +74,7 @@ A new trait has been added: `FromEntropy`. This is automatically implemented for any type supporting `SeedableRng`, and provides construction from fresh, strong entropy: -```rust +```rust,noplayground use rand_0_5::{ChaChaRng, FromEntropy}; let mut rng = ChaChaRng::from_entropy(); @@ -120,7 +120,8 @@ use cannot be guaranteed.* A new `Error` type has been added, designed explicitly for no-std compatibility, simplicity, and enough flexibility for our uses (carrying a `cause` when possible): -```ignore +```rust,noplayground +# use rand_0_5::ErrorKind; pub struct Error { pub kind: ErrorKind, pub msg: &'static str, @@ -181,7 +182,7 @@ The method `ChaChaRng::set_counter` has been replaced by two new methods, `set_word_pos` and `set_stream`. Where necessary, the behaviour of the old method may be emulated as follows: -```rust +```rust,noplayground # extern crate rand; # extern crate rand_chacha; # use rand::prelude::*; diff --git a/src/update-0.7.md b/src/update-0.7.md index f9395bd..9749902 100644 --- a/src/update-0.7.md +++ b/src/update-0.7.md @@ -23,7 +23,7 @@ The [`FromEntropy`] trait has now been removed. Fear not though, its [`from_entropy`] method continues to provide easy initialisation from its new home in the [`SeedableRng`] trait (this requires that `rand_core` has the `std` or `getrandom` feature enabled): -```rust +```rust,noplayground # extern crate rand_0_7 as rand; use rand::{SeedableRng, rngs::StdRng}; let mut rng = StdRng::from_entropy(); diff --git a/src/update-0.8.md b/src/update-0.8.md index 326a9ab..471ce6b 100644 --- a/src/update-0.8.md +++ b/src/update-0.8.md @@ -52,7 +52,7 @@ let a: u32 = Standard.sample_iter(rng).next().unwrap(); let b: u32 = Standard.sample_iter(rng).next().unwrap(); ``` can be replaced with the following code: -```rust +```rust,noplayground # extern crate rand; # use rand_0_8::prelude::*; # use rand_0_8::distributions::Standard; @@ -130,7 +130,7 @@ Several smaller changes occurred to rand distributions: .collect(); ``` With Rand 0.8, this is equivalent to the following: - ```rust + ```rust,noplayground # extern crate rand; # use rand_0_8::{distributions::Alphanumeric, Rng}; # fn main() { diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 8d9ef91..36154e3 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tests" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies]