arbitrary/foreign/core/
bool.rs

1use crate::{Arbitrary, Result, Unstructured};
2
3impl<'a> Arbitrary<'a> for bool {
4    fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
5        Ok(<u8 as Arbitrary<'a>>::arbitrary(u)? & 1 == 1)
6    }
7
8    #[inline]
9    fn size_hint(depth: usize) -> (usize, Option<usize>) {
10        <u8 as Arbitrary<'a>>::size_hint(depth)
11    }
12}