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
14
use proptest::arbitrary::StrategyFor;
use proptest::prelude::*;
use proptest::strategy::Map;

use crate::{Bytes, Format};

impl<F: Format> Arbitrary for Bytes<F> {
    type Parameters = ();
    type Strategy = Map<StrategyFor<Vec<u8>>, fn(Vec<u8>) -> Self>;

    fn arbitrary_with((): Self::Parameters) -> Self::Strategy {
        any::<Vec<u8>>().prop_map(Self::from)
    }
}