File tree 5 files changed +12
-4
lines changed
5 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
- Enable the ` std ` feature by default. (#409 )
10
10
- Change ` BlockRng64::inner ` and add ` BlockRng64::inner_mut ` to mirror ` BlockRng ` . (#419 )
11
11
- Add ` BlockRng{64}::index ` and ` BlockRng{64}::generate_and_set ` . (#374 , #419 )
12
+ - Add ` AsMut<[Self::Item]> ` bound to ` BlockRngCore::Results ` (future-proofing). (#419 )
12
13
13
14
## [ 0.1.0] - 2018-04-17
14
15
(Split out of the Rand crate, changes here are relative to rand 0.4.2)
Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ impl<R: BlockRngCore> BlockRng<R> {
232
232
}
233
233
234
234
impl < R : BlockRngCore < Item =u32 > > RngCore for BlockRng < R >
235
- where <R as BlockRngCore >:: Results : AsRef < [ u32 ] >
235
+ where <R as BlockRngCore >:: Results : AsRef < [ u32 ] > + AsMut < [ u32 ] >
236
236
{
237
237
#[ inline( always) ]
238
238
fn next_u32 ( & mut self ) -> u32 {
@@ -435,7 +435,7 @@ impl<R: BlockRngCore> BlockRng64<R> {
435
435
}
436
436
437
437
impl < R : BlockRngCore < Item =u64 > > RngCore for BlockRng64 < R >
438
- where <R as BlockRngCore >:: Results : AsRef < [ u64 ] >
438
+ where <R as BlockRngCore >:: Results : AsRef < [ u64 ] > + AsMut < [ u64 ] >
439
439
{
440
440
#[ inline( always) ]
441
441
fn next_u32 ( & mut self ) -> u32 {
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ pub trait BlockRngCore {
237
237
238
238
/// Results type. This is the 'block' an RNG implementing `BlockRngCore`
239
239
/// generates, which will usually be an array like `[u32; 16]`.
240
- type Results : AsRef < [ Self :: Item ] > + Default ;
240
+ type Results : AsRef < [ Self :: Item ] > + AsMut < [ Self :: Item ] > + Default ;
241
241
242
242
/// Generate a new block of results.
243
243
fn generate ( & mut self , results : & mut Self :: Results ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ impl<T> ::core::convert::AsRef<[T]> for IsaacArray<T> {
38
38
}
39
39
}
40
40
41
+ impl < T > :: core:: convert:: AsMut < [ T ] > for IsaacArray < T > {
42
+ #[ inline( always) ]
43
+ fn as_mut ( & mut self ) -> & mut [ T ] {
44
+ & mut self . inner [ ..]
45
+ }
46
+ }
47
+
41
48
impl < T > :: core:: ops:: Deref for IsaacArray < T > {
42
49
type Target = [ T ; RAND_SIZE ] ;
43
50
#[ inline( always) ]
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ where R: BlockRngCore + SeedableRng,
84
84
// implements RngCore, but we can't specify that because ReseedingCore is private
85
85
impl < R , Rsdr : RngCore > RngCore for ReseedingRng < R , Rsdr >
86
86
where R : BlockRngCore < Item = u32 > + SeedableRng ,
87
- <R as BlockRngCore >:: Results : AsRef < [ u32 ] >
87
+ <R as BlockRngCore >:: Results : AsRef < [ u32 ] > + AsMut < [ u32 ] >
88
88
{
89
89
#[ inline( always) ]
90
90
fn next_u32 ( & mut self ) -> u32 {
You can’t perform that action at this time.
0 commit comments