11//! The [`Generator`] trait and [`BlockRng`]
22//!
3- //! Trait [`Generator`] and marker trait [`CryptoGenerator`] may be implemented
4- //! by block-generators; that is PRNGs whose output is a *block* of words, such
5- //! as `[u32; 16]`.
3+ //! Trait [`Generator`] may be implemented by block-generators; that is PRNGs
4+ //! whose output is a *block* of words, such as `[u32; 16]`.
65//!
76//! The struct [`BlockRng`] wraps such a [`Generator`] together with an output
87//! buffer and implements several methods (e.g. [`BlockRng::next_word`]) to
7271//! # assert_eq!(rng.next_u32(), 1171109249);
7372//! ```
7473//!
75- //! # ReseedingRng
76- //!
77- //! The [`Generator`] trait supports usage of [`rand::rngs::ReseedingRng`].
78- //! This requires that [`SeedableRng`] be implemented on the "core" generator.
79- //! Additionally, it may be useful to implement [`CryptoGenerator`].
80- //! (This is in addition to any implementations on an [`TryRng`] type.)
81- //!
82- //! [`Generator`]: crate::block::Generator
8374//! [`TryRng`]: crate::TryRng
8475//! [`SeedableRng`]: crate::SeedableRng
85- //! [`rand::rngs::ReseedingRng`]: https://docs.rs/rand/latest/rand/rngs/struct.ReseedingRng.html
8676
8777use crate :: utils:: Word ;
8878use core:: fmt;
@@ -109,18 +99,6 @@ pub trait Generator {
10999 }
110100}
111101
112- /// A cryptographically secure generator
113- ///
114- /// This is a marker trait used to indicate that a [`Generator`] implementation
115- /// is supposed to be cryptographically secure.
116- ///
117- /// Mock generators should not implement this trait *except* under a
118- /// `#[cfg(test)]` attribute to ensure that mock "crypto" generators cannot be
119- /// used in production.
120- ///
121- /// See [`TryCryptoRng`](crate::TryCryptoRng) docs for more information.
122- pub trait CryptoGenerator : Generator { }
123-
124102/// RNG functionality for a block [`Generator`]
125103///
126104/// This type encompasses a [`Generator`] [`core`](Self::core) and a buffer.
0 commit comments