bytekind 0.2.0

Containers for byte arrays that are generic over their serialization format
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::{ByteArray, Format};
use proptest::arbitrary::StrategyFor;
use proptest::prelude::*;
use proptest::strategy::Map;

impl<F: Format, const N: usize> Arbitrary for ByteArray<F, N> {
    type Parameters = ();
    type Strategy = Map<StrategyFor<[u8; N]>, fn([u8; N]) -> Self>;

    fn arbitrary_with((): Self::Parameters) -> Self::Strategy {
        any::<[u8; N]>().prop_map(Self::from)
    }
}