From fb76c49ea7aac0533b4e43920a64d0b0f6ed1e44 Mon Sep 17 00:00:00 2001 From: Diego Barrios Romero Date: Wed, 30 Jun 2021 10:03:21 +0200 Subject: [PATCH] Remove RNG traits --- CHANGELOG.md | 3 +++ src/blocking/mod.rs | 1 - src/blocking/rng.rs | 16 ---------------- src/nb/mod.rs | 1 - src/nb/rng.rs | 12 ------------ 5 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 src/blocking/rng.rs delete mode 100644 src/nb/rng.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bad28bff..504c383a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `blocking::Serial`: renamed `bwrite_all` to `write`, `bflush` to `flush. - Removed `prelude` to avoid method name conflicts between different flavors (blocking, nb) of the same trait. Traits must now be manually imported. +### Removed +- Removed random number generation (`rng`) traits in favor of [rand_core](https://crates.io/crates/rand_core). + ## [v1.0.0-alpha.4] - 2020-11-11 ### Fixed diff --git a/src/blocking/mod.rs b/src/blocking/mod.rs index 9c98925a2..ac0132dc1 100644 --- a/src/blocking/mod.rs +++ b/src/blocking/mod.rs @@ -9,7 +9,6 @@ pub mod digital; pub mod i2c; pub mod pwm; pub mod qei; -pub mod rng; pub mod serial; pub mod spi; pub mod watchdog; diff --git a/src/blocking/rng.rs b/src/blocking/rng.rs deleted file mode 100644 index 7716d1449..000000000 --- a/src/blocking/rng.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! Blocking hardware random number generator - -/// Blocking read -pub trait Read { - /// Error type - type Error; - - /// Reads enough bytes from hardware random number generator to fill `buffer` - /// - /// If any error is encountered then this function immediately returns. The contents of buf are - /// unspecified in this case. - /// - /// If this function returns an error, it is unspecified how many bytes it has read, but it - /// will never read more than would be necessary to completely fill the buffer. - fn read(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error>; -} diff --git a/src/nb/mod.rs b/src/nb/mod.rs index ee3df2ae3..c687bdad5 100644 --- a/src/nb/mod.rs +++ b/src/nb/mod.rs @@ -17,7 +17,6 @@ pub use nb::{block, Error, Result}; pub mod adc; pub mod capture; -pub mod rng; pub mod serial; pub mod spi; pub mod timer; diff --git a/src/nb/rng.rs b/src/nb/rng.rs deleted file mode 100644 index 4e2b82128..000000000 --- a/src/nb/rng.rs +++ /dev/null @@ -1,12 +0,0 @@ -//! Random Number Generator Interface - -/// Nonblocking stream of random bytes. -pub trait Read { - /// An enumeration of RNG errors. - /// - /// For infallible implementations, will be `Infallible` - type Error; - - /// Get a number of bytes from the RNG. - fn read(&mut self, buf: &mut [u8]) -> nb::Result; -}