Generate some arbitrary flags value with only known bits set. */
(u: &mut arbitrary::Unstructured<'a>)
| 6 | Generate some arbitrary flags value with only known bits set. |
| 7 | */ |
| 8 | pub fn arbitrary<'a, B: Flags>(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<B> |
| 9 | where |
| 10 | B::Bits: arbitrary::Arbitrary<'a>, |
| 11 | { |
| 12 | B::from_bits(u.arbitrary()?).ok_or(arbitrary::Error::IncorrectFormat) |
| 13 | } |
| 14 | |
| 15 | #[cfg(test)] |
| 16 | mod tests { |
no outgoing calls