use crate::{size_hint, Arbitrary, MaxRecursionReached, Result, Unstructured}; impl<'a, A> Arbitrary<'a> for Option where A: Arbitrary<'a>, { fn arbitrary(u: &mut Unstructured<'a>) -> Result { Ok(if >::arbitrary(u)? { Some(Arbitrary::arbitrary(u)?) } else { None }) } #[inline] fn size_hint(depth: usize) -> (usize, Option) { Self::try_size_hint(depth).unwrap_or_default() } #[inline] fn try_size_hint(depth: usize) -> Result<(usize, Option), MaxRecursionReached> { Ok(size_hint::and( ::try_size_hint(depth)?, size_hint::or((0, Some(0)), ::try_size_hint(depth)?), )) } }