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
+ - Change ` BlockRngCore::Results ` bound to also require ` AsMut<[Self::Item]> ` . (#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 @@ -249,7 +249,7 @@ impl<R: BlockRngCore> BlockRng<R> {
249
249
}
250
250
251
251
impl < R : BlockRngCore < Item =u32 > > RngCore for BlockRng < R >
252
- where <R as BlockRngCore >:: Results : AsRef < [ u32 ] >
252
+ where <R as BlockRngCore >:: Results : AsRef < [ u32 ] > + AsMut < [ u32 ] >
253
253
{
254
254
#[ inline( always) ]
255
255
fn next_u32 ( & mut self ) -> u32 {
@@ -448,7 +448,7 @@ impl<R: BlockRngCore> BlockRng64<R> {
448
448
}
449
449
450
450
impl < R : BlockRngCore < Item =u64 > > RngCore for BlockRng64 < R >
451
- where <R as BlockRngCore >:: Results : AsRef < [ u64 ] >
451
+ where <R as BlockRngCore >:: Results : AsRef < [ u64 ] > + AsMut < [ u64 ] >
452
452
{
453
453
#[ inline( always) ]
454
454
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