| 1 |
use { |
| 2 |
crate::{size_hint, Arbitrary, Result, Unstructured}, |
| 3 |
core::cmp::Reverse, |
| 4 |
}; |
| 5 |
|
| 6 |
impl<'a, A> Arbitrary<'a> for Reverse<A> |
| 7 |
where |
| 8 |
A: Arbitrary<'a>, |
| 9 |
{ |
| 10 |
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> { |
| 11 |
Arbitrary::arbitrary(u).map(Self) |
| 12 |
} |
| 13 |
|
| 14 |
#[inline] |
| 15 |
fn size_hint(depth: usize) -> (usize, Option<usize>) { |
| 16 |
Self::try_size_hint(depth).unwrap_or_default() |
| 17 |
} |
| 18 |
|
| 19 |
#[inline] |
| 20 |
fn try_size_hint(depth: usize) -> Result<(usize, Option<usize>), crate::MaxRecursionReached> { |
| 21 |
size_hint::try_recursion_guard(depth, <A as Arbitrary>::try_size_hint) |
| 22 |
} |
| 23 |
} |