arbitrary
The trait for generating structured data from unstructured data
1.4.2
147M downloads/mo
#620 most downloaded on crates.io
rust-fuzz/arbitrary
What this package is like to depend on
Last release 1 years ago
14 Aug 2025
Release timing varies
gaps range from 9 days to 12 months
Most releases are documented
notes for 32 of 36 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
38 releases · first in 2017
0 releases in the last 12 months
see the full history below
Release timeline
38 releases · May 2017 to Aug 2025Releases
latest 38-
1.4.214 Aug 2025Release notes
Open source →Released 2025-08-13.
Added
- Added formal MSRV policy: "We reserve the right to increment the MSRV on minor releases, however we will strive to only do it deliberately and for good reasons." The current MSRV is 1.63.0.
- Added an
Arbitraryimplementation forcore::cmp::Reverse.
Changed
- Landed a handful of changes to the code generated by
#[derive(Arbitrary)]that speed up compilation.
Fixed
- Better documented bias and behavior when running out of entropy, fixed some outdated and incorrect docs related to this.
-
1.4.105 Nov 2024 -
1.4.004 Nov 2024Release notes
Open source →Released 2024-10-30.
Added
- Added an
Arbitraryimplementation forPhantomPinned. - Added the
Unstructured::choose_iterhelper method. - Added
#[arbitrary(skip)]forenumvariants in the derive macro. - Added the
Arbitrary::try_size_hinttrait method.
Changed
- Implement
ArbitraryforPhantomData<A>even whenAdoes not implementArbitraryand whenAis?Sized. - Make
usize's underlying encoding independent of machine word size so that corpora are more portable.
Fixed
- Make
derive(Arbitrary)work for local definitions ofstruct Option.
- Added an
-
1.3.230 Oct 2023Release notes
Open source → -
1.3.111 Oct 2023Release notes
Open source →Released 2023-10-11.
Fixed
- Fixed an issue with generating collections of collections in
arbitrary_take_restwhere<Vec<Vec<u8>>>::arbitrary_take_restwould never generatevec![vec![]]for example. See #159 for details.
- Fixed an issue with generating collections of collections in
-
1.3.013 Mar 2023Release notes
Open source →Released 2023-03-13.
Added
- Added the ability to manually specify derived trait bounds for
Arbitrary. See #138 for details.
Fixed
- Fixed minimal versions correctness for
syn.
- Added the ability to manually specify derived trait bounds for
-
1.2.323 Jan 2023Release notes
Open source →Released 2023-01-20.
Fixed
- The
derive(Arbitrary)will now annotate the generatedimpls with a#[automatically_derived]attribute to indicate to e.g. clippy that lints should not fire for the code within the derived implementation.
- The
-
1.2.203 Jan 2023Release notes
Open source →Released 2023-01-03.
Fixed
- Ensured that
arbitraryandderive_arbitraryversions are synced up so that they don't, e.g., emit generated code that depends on newer versions ofarbitrarythan the one currently in use. #134
- Ensured that
-
1.2.020 Oct 2022Release notes
Open source → -
1.1.705 Oct 2022Nothing published for this version
-
1.1.608 Sep 2022Release notes
Open source →Released 2022-09-20.
Fixed
- Fixed a potential panic due to an off-by-one error in the
Arbitraryimplementation forstd::ops::Bound<T>.
- Fixed a potential panic due to an off-by-one error in the
-
1.1.507 Sep 2022Release notes
Open source →Released 2022-09-08.
Added
- Implemented
Arbitraryforstd::ops::Bound<T>.
Fixed
- Fixed a bug where
Unstructured::int_in_rangecould return out-of-range integers when generating arbitrary signed integers.
- Implemented
-
1.1.429 Aug 2022Release notes
Open source →Released 2022-08-29.
Added
- Implemented
ArbitraryforRc<str>andArc<str>
Changed
- Allow overriding the error type in
arbitrary::Result - The
Unstructured::arbitrary_loopmethod will consume fewer bytes of input now.
Fixed
- Fixed a bug where
Unstructured::int_in_rangecould return out-of-range integers.
- Implemented
-
1.1.323 Jun 2022Release notes
Open source →Released 2022-06-23.
Fixed
- Fixed some potential (but highly unlikely) name-clashes inside
derive(Arbitrary)'s generated code. #111 - Fixed an edge case where
derive(Arbitrary)for recursive types that detected an overflow would not reset the overflow detection. #111
- Fixed some potential (but highly unlikely) name-clashes inside
-
1.1.216 Jun 2022Release notes
Open source → -
1.1.114 Jun 2022Release notes
Open source →Released 2022-06-14.
Fixed
- Fixed a stack overflow when using
derive(Arbitrary)with recursive types and empty inputs. #109
- Fixed a stack overflow when using
-
1.1.010 Feb 2022Release notes
Open source →Released 2022-02-09.
Added
-
Added the
Unstructured::ratiomethod to generate a boolean that istrueat the given rate. -
Added the
Unstructured::arbitrary_loopmethod to call a function an arbitrary number of times.
-
-
1.0.315 Nov 2021Release notes
Open source →Released 2021-11-20.
Fixed
- Fixed documentation for
Unstructured::fill_bytes. We forgot to update this way back in #53 when the behavior changed.
- Fixed documentation for
-
1.0.226 Aug 2021Release notes
Open source → -
1.0.120 May 2021 -
1.0.024 Feb 2021Release notes
Open source →Released 2020-02-24.
See 1.0.0-rc1 and 1.0.0-rc2 for changes since 0.4.7, which was the last main line release.
-
1.0.0-rc209 Feb 2021 pre-releaseRelease notes
Open source →Released 2021-02-09.
Added
- The
Arbitrarytrait is now implemented for&[u8]. #67
Changed
- Rename
Unstructured#get_bytestoUnstructured#bytes. #70 - Passing an empty slice of choices to
Unstructured#choosereturns an error. Previously it would panic. 71
- The
-
1.0.0-rc126 Nov 2020 pre-releaseRelease notes
Open source →Released 2020-11-25.
Added
- The
Arbitrarytrait is now implemented for&str. #63
Changed
- The
Arbitrarytrait now has a lifetime parameter, allowingArbitraryimplementations that borrow from the raw input (e.g. the new&strimplementaton). Thederive(Arbitrary)macro also supports derivingArbitraryon types with lifetimes now. #63
Removed
-
The
shrinkmethod on theArbitrarytrait has been removed.We have found that, in practice, using internal reduction via approaches like
cargo fuzz tmin, where the raw input bytes are reduced rather than theT: Arbitrarytype constructed from those raw bytes, has the best efficiency-to-maintenance ratio. To the best of our knowledge, no one is relying on or using theArbitrary::shrinkmethod. If you are using and relying on theArbitrary::shrinkmethod, please reach out by dropping a comment here and explaining how you're using it and what your use case is. We'll figure out what the best solution is, including potentially adding shrinking functionality back to thearbitrarycrate.
- The
-
0.4.714 Oct 2020Release notes
Open source →Released 2020-10-14.
Added
-
Added an optimization to avoid unnecessarily consuming bytes from the underlying data when there is only one possible choice in
Unstructured::{int_in_range, choose, etc..}. -
Added license files to the derive crate.
Changed
- The
Arbitraryimplementation forstd::time::Durationshould now be faster and produce durations with a more-uniform distribution of nanoseconds.
-
-
0.4.622 Aug 2020Release notes
Open source →Released 2020-08-22.
Added
- Added the
Unstructured::peek_bytesmethod.
Changed
-
Test case reduction via
cargo fuzz tminshould be much more effective at reducing the sizes of collections now. (See #53 and the commit messages for details.) -
Fuzzing with mutation-based fuzzers (like libFuzzer) should be more efficient now. (See #53 and the commit messages for details)
- Added the
-
0.4.518 Jun 2020Release notes
Open source →Released 2020-06-18.
Added
- Implement
Arbitraryfor zero length arrays. - Implement
ArbitraryforRangeandRangeInclusive.
- Implement
-
0.4.429 Apr 2020Release notes
Open source →Released 2020-04-29.
Fixed
- Fixed the custom derive for enums when used via its full path (like
#[derive(arbitrary::Arbitrary)]rather than like#[derive(Arbitrary)]).
- Fixed the custom derive for enums when used via its full path (like
-
0.4.328 Apr 2020Release notes
Open source →Released 2020-04-28.
Fixed
- Fixed the custom derive when used via its full path (like
#[derive(arbitrary::Arbitrary)]rather than like#[derive(Arbitrary)]).
- Fixed the custom derive when used via its full path (like
-
0.4.217 Apr 2020Release notes
Open source →Released 2020-04-17.
Changed
- We forgot to release a new version of the
derive_arbitrarycrate last release. This release fixes that and so thesynstructuredependency is finally actually removed in the cargo releases.
- We forgot to release a new version of the
-
0.4.118 Mar 2020Release notes
Open source →Released 2020-03-18.
Removed
- Removed an internal dependency on the
synstructurecrate when thederivefeature is enabled. This should not have any visible downstream effects other than faster build times!
- Removed an internal dependency on the
-
0.4.022 Jan 2020Release notes
Open source →Released 2020-01-22.
This is technically a breaking change, but we expect that nearly everyone should be able to upgrade without any compilation errors. The only exception is if you were implementing the
Arbitrary::size_hintmethod by hand. If so, see the "changed" section below and the API docs forArbitrary::shrinkfor details.Added
- Added the
arbitary::size_hint::recursion_guardhelper function for guarding against infinite recursion insize_hintimplementations for recursive types.
Changed
- The
Arbitrary::size_hintsignature now takes adepth: usizeparameter. This should be passed along unmodified to any nested calls of othersize_hintmethods. If you're implementingsize_hintfor a recursive type (like a linked list or tree) or a generic type with type parameters, you should use the newarbitrary::size_hint::recursion_guardhelper function.
Fixed
- Fixed infinite recursion in generated
size_hintimplementations from#[derive(Arbitrary)]for recursive types.
- Added the
-
0.3.316 Jan 2020Nothing published for this version
-
0.3.216 Jan 2020 -
0.3.114 Jan 2020Release notes
Open source →Released 2020-01-14.
Fixed
- Fixed some links and version numbers in README.
-
0.3.014 Jan 2020Release notes
Open source →Released 2020-01-14.
Added
- Added the
"derive"cargo feature, to enable#[derive(Arbitrary)]for custom types. Enabling this feature re-exports functionality from thederive_arbitrarycrate. - The custom derive for
Arbitraryimplements the shrink method for you now. - All implementations of
Arbitraryforstdtypes implement shrinking now. - Added the
Arbitrary::arbitrary_take_restmethod allows anArbitraryimplementation to consume all of the rest of the remaining raw input. It has a default implementation that forwards toArbitrary::arbitraryand the custom derive creates a smart implementation for your custom types. - Added the
Arbitrary::size_hintmethod for hinting how many raw bytes an implementation needs to construct itself. This has a default implementation, but the custom derive creates a smart implementation for your custom types. - Added the
Unstructured::choosemethod to choose one thing among a set of choices. - Added the
Unstructured::arbitrary_lenmethod to get an arbitrary length for a collection of some arbitrary type. - Added the
Unstructured::arbitrary_itermethod to create an iterator of arbitrary instance of some type.
Changed
- The
Arbitrarytrait was simplified a bit. Unstructuredis a concrete type now, not a trait.- Switched to Rust 2018 edition.
Removed
RingBufferandFiniteBufferare removed. UseUnstructuredinstead.
Fixed
- Better
Arbitraryimplementation forchar. - Better
Arbitraryimplementation forString.
- Added the
-
0.2.017 Sep 2018 -
0.1.103 Apr 2018Nothing published for this version
-
0.1.008 May 2017Nothing published for this version