smol-bytes 0.1.7

High-performance, clone-efficient byte buffers optimized for small data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::{Buffer, INLINE_CAP};

use quickcheck::Arbitrary;

impl Arbitrary for Buffer {
  fn arbitrary(g: &mut quickcheck::Gen) -> Self {
    let num = usize::arbitrary(g) % (INLINE_CAP + 1);
    let mut buf = Self::new();
    for _ in 0..num {
      buf.put_bytes(u8::arbitrary(g), 1);
    }
    buf
  }
}