111
111
112
112
#[ cfg( feature = "std" ) ]
113
113
use std:: time:: Duration ;
114
+ #[ cfg( all( not( feature = "std" ) , rust_1_25) ) ]
115
+ use core:: time:: Duration ;
114
116
115
117
use Rng ;
116
118
use distributions:: Distribution ;
@@ -833,14 +835,14 @@ uniform_float_impl! { f64x8, u64x8, f64, u64, 64 - 52 }
833
835
///
834
836
/// [`UniformSampler`]: trait.UniformSampler.html
835
837
/// [`Uniform`]: struct.Uniform.html
836
- #[ cfg( feature = "std" ) ]
838
+ #[ cfg( any ( feature = "std" , rust_1_25 ) ) ]
837
839
#[ derive( Clone , Copy , Debug ) ]
838
840
pub struct UniformDuration {
839
841
mode : UniformDurationMode ,
840
842
offset : u32 ,
841
843
}
842
844
843
- #[ cfg( feature = "std" ) ]
845
+ #[ cfg( any ( feature = "std" , rust_1_25 ) ) ]
844
846
#[ derive( Debug , Copy , Clone ) ]
845
847
enum UniformDurationMode {
846
848
Small {
@@ -857,12 +859,12 @@ enum UniformDurationMode {
857
859
}
858
860
}
859
861
860
- #[ cfg( feature = "std" ) ]
862
+ #[ cfg( any ( feature = "std" , rust_1_25 ) ) ]
861
863
impl SampleUniform for Duration {
862
864
type Sampler = UniformDuration ;
863
865
}
864
866
865
- #[ cfg( feature = "std" ) ]
867
+ #[ cfg( any ( feature = "std" , rust_1_25 ) ) ]
866
868
impl UniformSampler for UniformDuration {
867
869
type X = Duration ;
868
870
@@ -1206,9 +1208,12 @@ mod tests {
1206
1208
1207
1209
1208
1210
#[ test]
1209
- #[ cfg( feature = "std" ) ]
1211
+ #[ cfg( any ( feature = "std" , rust_1_25 ) ) ]
1210
1212
fn test_durations ( ) {
1213
+ #[ cfg( feature = "std" ) ]
1211
1214
use std:: time:: Duration ;
1215
+ #[ cfg( all( not( feature = "std" ) , rust_1_25) ) ]
1216
+ use core:: time:: Duration ;
1212
1217
1213
1218
let mut rng = :: test:: rng ( 253 ) ;
1214
1219
0 commit comments