• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use {
2     crate::{size_hint, Arbitrary, Result, Unstructured},
3     core::time::Duration,
4 };
5 
6 impl<'a> Arbitrary<'a> for Duration {
arbitrary(u: &mut Unstructured<'a>) -> Result<Self>7     fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
8         Ok(Self::new(
9             <u64 as Arbitrary>::arbitrary(u)?,
10             u.int_in_range(0..=999_999_999)?,
11         ))
12     }
13 
14     #[inline]
size_hint(depth: usize) -> (usize, Option<usize>)15     fn size_hint(depth: usize) -> (usize, Option<usize>) {
16         size_hint::and(
17             <u64 as Arbitrary>::size_hint(depth),
18             <u32 as Arbitrary>::size_hint(depth),
19         )
20     }
21 }
22