use { crate::{Arbitrary, MaxRecursionReached, Result, Unstructured}, core::cell::{Cell, RefCell, UnsafeCell}, }; impl<'a, A> Arbitrary<'a> for Cell where A: Arbitrary<'a>, { fn arbitrary(u: &mut Unstructured<'a>) -> Result { Arbitrary::arbitrary(u).map(Self::new) } #[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> { >::try_size_hint(depth) } } impl<'a, A> Arbitrary<'a> for RefCell where A: Arbitrary<'a>, { fn arbitrary(u: &mut Unstructured<'a>) -> Result { Arbitrary::arbitrary(u).map(Self::new) } #[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> { >::try_size_hint(depth) } } impl<'a, A> Arbitrary<'a> for UnsafeCell where A: Arbitrary<'a>, { fn arbitrary(u: &mut Unstructured<'a>) -> Result { Arbitrary::arbitrary(u).map(Self::new) } #[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> { >::try_size_hint(depth) } }