BurntSushi / BurntSushi/quickcheck

Implement Arbitrary for AsMut<[T: Arbitrary]>

Open
#291 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.8k
Forks
165
PR merge metrics
No merged PRs in 30d

Description

Because of #265, it's no longer possible to do something like

```rust
#[derive(Clone, Debug)]
#[cfg_attr(test, derive(PartialEq, Eq))]
struct Foo {
foo: ChaChaPolyNonce, // has a BorrowMut<[u8]> impl
}

#[cfg(test)]
impl quickcheck::Arbitrary for Foo {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
let mut foo = ChaChaPolyNonce::default();
g.fill_bytes(&mut foo); // No more RngCore!
Self { foo }
}
}
```

But it seems as though it would be reasonable to simply have an `Arbitrary` implementation for `&mut [T: Arbitrary]` that does `fill_bytes` internally.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.