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