mod private
{
use core :: { ops ::Deref, ops ::DerefMut };
#[ cfg(not(feature = "no_std")) ]
use crate ::Seed;
#[ derive(Debug) ]
pub struct SharedGenerator;
impl SharedGenerator
{
#[ inline(always) ]
#[ allow(clippy ::unused_self) ]
pub fn lock(self) -> SharedGeneratorLock
{
SharedGeneratorLock
}
}
#[ derive(Debug) ]
pub struct SharedGeneratorLock;
impl SharedGeneratorLock
{
#[ inline(always) ]
#[ allow(clippy ::unused_self) ]
pub fn unwrap(self) -> DerefRng
{
DerefRng(rand ::thread_rng())
}
}
#[ derive(Debug) ]
pub struct DerefRng(rand ::rngs ::ThreadRng);
impl Deref for DerefRng
{
type Target = rand ::rngs ::ThreadRng;
#[ inline(always) ]
fn deref( &self ) -> &Self ::Target
{
&self.0
}
}
impl DerefMut for DerefRng
{
fn deref_mut( &mut self ) -> &mut Self ::Target
{
&mut self.0
}
}
impl Default for Hrng
{
fn default() -> Self
{
Hrng ::master()
}
}
#[ derive(Debug, Clone) ]
pub struct Hrng;
impl Hrng
{
#[ inline(always) ]
#[ must_use ]
pub fn master() -> Self
{
Self
}
#[ cfg(not(feature = "no_std")) ]
#[ inline(always) ]
pub fn master_with_seed(_: Seed) -> Self
{
Self
}
#[ inline(always) ]
#[ must_use ]
pub fn rng_ref( &self ) -> SharedGenerator
{
SharedGenerator
}
#[ inline(always) ]
#[ must_use ]
pub fn child(&self, _: usize) -> Self
{
Self
}
#[ inline(always) ]
#[ must_use ]
pub fn _children_len( &self ) -> usize
{
0
}
}
}
crate ::mod_interface! {
orphan use Hrng;
}