Skip to content

Commit d600ce6

Browse files
committed
Add pub and doc comments to ThreadRngCore to make it ready for re-export
1 parent 8a0deb7 commit d600ce6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/rngs/thread.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ impl ReseedingCore {
7575
}
7676

7777
/// The [`ThreadRng`] internal
78-
struct ThreadRngCore {
78+
///
79+
/// This type is the actual pseudo-random number generator that powers [`ThreadRng`]. The same
80+
/// Security design criteria and consideration as those of [`ThreadRng`] apply, whereas it allows
81+
/// users to utilize the same reseeding generator where `Send` or `Sync` is required.
82+
pub struct ThreadRngCore {
7983
inner: BlockRng<ReseedingCore>,
8084
}
8185

@@ -88,7 +92,7 @@ impl fmt::Debug for ThreadRngCore {
8892

8993
impl ThreadRngCore {
9094
/// Initialize the generator using [`SysRng`]
91-
fn new() -> Result<Self, SysError> {
95+
pub fn new() -> Result<Self, SysError> {
9296
Core::try_from_rng(&mut SysRng).map(|result| Self {
9397
inner: BlockRng::new(ReseedingCore { inner: result }),
9498
})
@@ -97,7 +101,7 @@ impl ThreadRngCore {
97101
/// Immediately reseed the generator
98102
///
99103
/// This discards any remaining random data in the cache.
100-
fn reseed(&mut self) -> Result<(), SysError> {
104+
pub fn reseed(&mut self) -> Result<(), SysError> {
101105
self.inner.reset_and_skip(0);
102106
self.inner.core.reseed()
103107
}

0 commit comments

Comments
 (0)