use { crate::{size_hint, Arbitrary, Result, Unstructured}, std::borrow::{Cow, ToOwned}, }; impl<'a, A> Arbitrary<'a> for Cow<'a, A> where A: ToOwned + ?Sized + 'a, ::Owned: Arbitrary<'a>, { fn arbitrary(u: &mut Unstructured<'a>) -> Result { Arbitrary::arbitrary(u).map(Cow::Owned) } #[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), crate::MaxRecursionReached> { size_hint::try_recursion_guard(depth, |depth| { <::Owned as Arbitrary>::try_size_hint(depth) }) } }