arbitrary/foreign/core/
slice.rs

1use crate::{Arbitrary, Result, Unstructured};
2
3impl<'a> Arbitrary<'a> for &'a [u8] {
4    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
5        let len = u.arbitrary_len::<u8>()?;
6        u.bytes(len)
7    }
8
9    fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self> {
10        Ok(u.take_rest())
11    }
12
13    #[inline]
14    fn size_hint(_depth: usize) -> (usize, Option<usize>) {
15        (0, None)
16    }
17}