File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use rand::{
7
7
use crate :: MultihashGeneric ;
8
8
9
9
/// Generates a random valid multihash.
10
- impl Arbitrary for MultihashGeneric < 64 > {
10
+ impl < const S : usize > Arbitrary for MultihashGeneric < S > {
11
11
fn arbitrary < G : Gen > ( g : & mut G ) -> Self {
12
12
// In real world lower multihash codes are more likely to happen, hence distribute them
13
13
// with bias towards smaller values.
@@ -25,9 +25,9 @@ impl Arbitrary for MultihashGeneric<64> {
25
25
_ => unreachable ! ( ) ,
26
26
} ;
27
27
28
- // Maximum size is 64 byte due to the `U64` generic
29
- let size = g. gen_range ( 0 , 64 ) ;
30
- let mut data = [ 0 ; 64 ] ;
28
+ // Maximum size is S byte due to the generic.
29
+ let size = g. gen_range ( 0 , S ) ;
30
+ let mut data = [ 0 ; S ] ;
31
31
g. fill_bytes ( & mut data) ;
32
32
MultihashGeneric :: wrap ( code, & data[ ..size] ) . unwrap ( )
33
33
}
You can’t perform that action at this time.
0 commit comments