(
rng: &mut StdRng,
mut f: impl FnMut(&mut Unstructured<'_>) -> arbitrary::Result<T>,
)
| 179 | } |
| 180 | |
| 181 | fn generate<T>( |
| 182 | rng: &mut StdRng, |
| 183 | mut f: impl FnMut(&mut Unstructured<'_>) -> arbitrary::Result<T>, |
| 184 | ) -> Result<T> { |
| 185 | let mut bytes = Vec::new(); |
| 186 | loop { |
| 187 | let count = rng.random_range(1000..2000); |
| 188 | bytes.extend(iter::repeat_with(|| rng.random::<u8>()).take(count)); |
| 189 | |
| 190 | match f(&mut Unstructured::new(&bytes)) { |
| 191 | Ok(ret) => break Ok(ret), |
| 192 | Err(arbitrary::Error::NotEnoughData) => (), |
| 193 | Err(error) => break Err(Error::from(error)), |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | } |