File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -804,7 +804,7 @@ pub trait SeedableRng: Sized {
804
804
/// [`NewRng`]: trait.NewRng.html
805
805
/// [`OsRng`]: os/struct.OsRng.html
806
806
/// [`XorShiftRng`]: prng/xorshift/struct.XorShiftRng.html
807
- fn from_rng < R : Rng > ( mut rng : R ) -> Result < Self , Error > {
807
+ fn from_rng < R : Rng > ( rng : & mut R ) -> Result < Self , Error > {
808
808
let mut seed = Self :: Seed :: default ( ) ;
809
809
rng. try_fill_bytes ( seed. as_mut ( ) ) ?;
810
810
Ok ( Self :: from_seed ( seed) )
@@ -844,7 +844,7 @@ pub trait NewRng: SeedableRng {
844
844
#[ cfg( feature="std" ) ]
845
845
impl < R : SeedableRng > NewRng for R {
846
846
fn new ( ) -> Result < Self , Error > {
847
- R :: from_rng ( EntropyRng :: new ( ) )
847
+ R :: from_rng ( & mut EntropyRng :: new ( ) )
848
848
}
849
849
}
850
850
@@ -919,7 +919,7 @@ impl SeedableRng for StdRng {
919
919
StdRng ( IsaacWordRng :: from_seed ( seed) )
920
920
}
921
921
922
- fn from_rng < R : Rng > ( rng : R ) -> Result < Self , Error > {
922
+ fn from_rng < R : Rng > ( rng : & mut R ) -> Result < Self , Error > {
923
923
IsaacWordRng :: from_rng ( rng) . map ( |rng| StdRng ( rng) )
924
924
}
925
925
}
Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ impl SeedableRng for IsaacRng {
347
347
init ( seed_extended, 2 )
348
348
}
349
349
350
- fn from_rng < R : Rng > ( mut rng : R ) -> Result < Self , Error > {
350
+ fn from_rng < R : Rng > ( rng : & mut R ) -> Result < Self , Error > {
351
351
// Custom `from_rng` implementation that fills a seed with the same size
352
352
// as the entire state.
353
353
let mut seed = [ w ( 0u32 ) ; RAND_SIZE ] ;
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ impl SeedableRng for Isaac64Rng {
322
322
init ( seed_extended, 2 )
323
323
}
324
324
325
- fn from_rng < R : Rng > ( mut rng : R ) -> Result < Self , Error > {
325
+ fn from_rng < R : Rng > ( rng : & mut R ) -> Result < Self , Error > {
326
326
// Custom `from_rng` implementation that fills a seed with the same size
327
327
// as the entire state.
328
328
let mut seed = [ w ( 0u64 ) ; RAND_SIZE ] ;
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ impl SeedableRng for XorShiftRng {
102
102
}
103
103
}
104
104
105
- fn from_rng < R : Rng > ( mut rng : R ) -> Result < Self , Error > {
105
+ fn from_rng < R : Rng > ( rng : & mut R ) -> Result < Self , Error > {
106
106
let mut seed_u32 = [ 0u32 ; 4 ] ;
107
107
loop {
108
108
unsafe {
You can’t perform that action at this time.
0 commit comments