| 1 |
use crate::{Array, SmallVec}; |
| 2 |
use arbitrary::{Arbitrary, Unstructured}; |
| 3 |
|
| 4 |
impl<'a, A: Array> Arbitrary<'a> for SmallVec<A> |
| 5 |
where |
| 6 |
<A as Array>::Item: Arbitrary<'a>, |
| 7 |
{ |
| 8 |
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { |
| 9 |
u.arbitrary_iter()?.collect() |
| 10 |
} |
| 11 |
|
| 12 |
fn arbitrary_take_rest(u: Unstructured<'a>) -> arbitrary::Result<Self> { |
| 13 |
u.arbitrary_take_rest_iter()?.collect() |
| 14 |
} |
| 15 |
|
| 16 |
fn size_hint(depth: usize) -> (usize, Option<usize>) { |
| 17 |
arbitrary::size_hint::and(<usize as Arbitrary>::size_hint(depth), (0, None)) |
| 18 |
} |
| 19 |
} |