Since #51 changed Any.value from Vec<u8> to bytes::Bytes, buffa-types no longer compiles with --features arbitrary:
$ cargo build -p buffa-types --features arbitrary
error[E0277]: the trait bound `buffa::bytes::Bytes: Arbitrary<'_>` is not satisfied
The bytes crate doesn't provide an Arbitrary impl, and the arbitrary crate doesn't provide one for Bytes either.
This also means cargo doc --workspace --all-features and cargo clippy --workspace --all-features fail at the compile step, which is how it surfaced.
Options
#[arbitrary(with = ...)] on Any.value via codegen field_attribute for the WKT gen — generate a Vec<u8> then .into(). Keeps the derive, scopes the workaround to the one field.
- Runtime helper in
buffa::__private — fn arbitrary_bytes<'a>(u: &mut Unstructured<'a>) -> arbitrary::Result<Bytes> that codegen attaches to every bytes_fields-typed field. Generalizes (1) to user bytes_fields too (which have the same problem).
- Drop
#[derive(Arbitrary)] on Any and hand-write the impl in buffa-types/src/any_ext.rs.
(2) is probably right since any user with bytes_fields + generate_arbitrary(true) hits the same wall. Filing for 0.4.1 since it's a feature-flag compile break.
Since #51 changed
Any.valuefromVec<u8>tobytes::Bytes,buffa-typesno longer compiles with--features arbitrary:The
bytescrate doesn't provide anArbitraryimpl, and thearbitrarycrate doesn't provide one forByteseither.This also means
cargo doc --workspace --all-featuresandcargo clippy --workspace --all-featuresfail at the compile step, which is how it surfaced.Options
#[arbitrary(with = ...)]onAny.valuevia codegenfield_attributefor the WKT gen — generate aVec<u8>then.into(). Keeps the derive, scopes the workaround to the one field.buffa::__private—fn arbitrary_bytes<'a>(u: &mut Unstructured<'a>) -> arbitrary::Result<Bytes>that codegen attaches to everybytes_fields-typed field. Generalizes (1) to userbytes_fieldstoo (which have the same problem).#[derive(Arbitrary)]onAnyand hand-write the impl inbuffa-types/src/any_ext.rs.(2) is probably right since any user with
bytes_fields+generate_arbitrary(true)hits the same wall. Filing for 0.4.1 since it's a feature-flag compile break.