#arbitrary #adapter #with

arbitrary_with

Adapters for #[arbitrary(with = ...)]

5 unstable releases

Uses new Rust 2024

0.3.2 Dec 6, 2025
0.3.1 Jun 18, 2025
0.3.0 Jun 17, 2025
0.2.0 Jun 17, 2025
0.1.0 Jun 17, 2025

#982 in Encoding

Download history 677/week @ 2026-01-22 444/week @ 2026-01-29 767/week @ 2026-02-05 1272/week @ 2026-02-12 326/week @ 2026-02-19 546/week @ 2026-02-26 1183/week @ 2026-03-05 1133/week @ 2026-03-12 297/week @ 2026-03-19 126/week @ 2026-03-26 203/week @ 2026-04-02 534/week @ 2026-04-09 390/week @ 2026-04-16 345/week @ 2026-04-23 333/week @ 2026-04-30 583/week @ 2026-05-07

1,868 downloads per month
Used in 2 crates (via near-account-id)

Custom license

38KB
1K SLoC

Example

#[derive(Arbitrary)]
struct A {
    #[arbitrary(with = As::<Option<DisplayFromStr<i32>>>::arbitrary)]
    n: Option<String>,
};

let a: A = u.arbitrary()?;
if let Some(n) = a.n {
    let _i: i32 = n.parse().unwrap();
}

arbitrary_with

docs.rs crates.io

serde_with analog for arbitrary

Dependencies

~0.5–1MB
~19K SLoC