diff --git a/src/rngs/adapter/mod.rs b/src/rngs/adapter/mod.rs index 22b7158d40f..bd1d2943233 100644 --- a/src/rngs/adapter/mod.rs +++ b/src/rngs/adapter/mod.rs @@ -11,5 +11,6 @@ mod read; mod reseeding; +#[allow(deprecated)] pub use self::read::{ReadError, ReadRng}; pub use self::reseeding::ReseedingRng; diff --git a/src/rngs/adapter/read.rs b/src/rngs/adapter/read.rs index 63b0dd0c0f0..25a9ca7fca4 100644 --- a/src/rngs/adapter/read.rs +++ b/src/rngs/adapter/read.rs @@ -9,6 +9,8 @@ //! A wrapper around any Read to treat it as an RNG. +#![allow(deprecated)] + use std::fmt; use std::io::Read; @@ -30,20 +32,10 @@ use rand_core::{impls, Error, RngCore}; /// have enough data, will only be reported through [`try_fill_bytes`]. /// The other [`RngCore`] methods will panic in case of an error. /// -/// # Example -/// -/// ``` -/// use rand::Rng; -/// use rand::rngs::adapter::ReadRng; -/// -/// let data = vec![1, 2, 3, 4, 5, 6, 7, 8]; -/// let mut rng = ReadRng::new(&data[..]); -/// println!("{:x}", rng.gen::()); -/// ``` -/// /// [`OsRng`]: crate::rngs::OsRng /// [`try_fill_bytes`]: RngCore::try_fill_bytes #[derive(Debug)] +#[deprecated(since="0.8.4", note="removal due to lack of usage")] pub struct ReadRng { reader: R, } @@ -86,6 +78,7 @@ impl RngCore for ReadRng { /// `ReadRng` error type #[derive(Debug)] +#[deprecated(since="0.8.4")] pub struct ReadError(std::io::Error); impl fmt::Display for ReadError {