PackageTrack
Sign in Get early access

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 2025
2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 38
  1. 1.4.2 14 Aug 2025
    Release notes

    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 Arbitrary implementation for core::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.

    Open source →
  2. 1.4.1 05 Nov 2024
    Release notes

    Released 2024-11-05.


    Open source →
  3. 1.4.0 04 Nov 2024
    Release notes

    Released 2024-10-30.

    Added

    • Added an Arbitrary implementation for PhantomPinned.
    • Added the Unstructured::choose_iter helper method.
    • Added #[arbitrary(skip)] for enum variants in the derive macro.
    • Added the Arbitrary::try_size_hint trait method.

    Changed

    • Implement Arbitrary for PhantomData<A> even when A does not implement Arbitrary and when A is ?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 of struct Option.

    Open source →
  4. 1.3.2 30 Oct 2023
    Release notes

    Released 2023-10-30.

    Added

    • Added Arbitrary implementations for Arc<[T]> and Rc<[T]>. #160

    Open source →
  5. 1.3.1 11 Oct 2023
    Release notes

    Released 2023-10-11.

    Fixed

    • Fixed an issue with generating collections of collections in arbitrary_take_rest where <Vec<Vec<u8>>>::arbitrary_take_rest would never generate vec![vec![]] for example. See #159 for details.

    Open source →
  6. 1.3.0 13 Mar 2023
    Release notes

    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.

    Open source →
  7. 1.2.3 23 Jan 2023
    Release notes

    bump arbitrary_derive to 1.2.3

    Open source →
    Release notes

    Released 2023-01-20.

    Fixed

    • The derive(Arbitrary) will now annotate the generated impls with a #[automatically_derived] attribute to indicate to e.g. clippy that lints should not fire for the code within the derived implementation.
    Open source →
  8. 1.2.2 03 Jan 2023
    Release notes

    Released 2023-01-03.

    Fixed

    • Ensured that arbitrary and derive_arbitrary versions are synced up so that they don't, e.g., emit generated code that depends on newer versions of arbitrary than the one currently in use. #134
    Open source →
  9. 1.2.0 20 Oct 2022
    Release notes

    Released 2022-10-20.

    Added

    • Support custom arbitrary implementation for fields on derive. #129

    Open source →
  10. 1.1.7 05 Oct 2022

    Nothing published for this version

  11. 1.1.6 08 Sep 2022
    Release notes

    Released 2022-09-20.

    Fixed

    • Fixed a potential panic due to an off-by-one error in the Arbitrary implementation for std::ops::Bound<T>.

    Open source →
  12. 1.1.5 07 Sep 2022
    Release notes

    Released 2022-09-08.

    Added

    • Implemented Arbitrary for std::ops::Bound<T>.

    Fixed

    • Fixed a bug where Unstructured::int_in_range could return out-of-range integers when generating arbitrary signed integers.

    Open source →
  13. 1.1.4 29 Aug 2022
    Release notes

    Released 2022-08-29.

    Added

    • Implemented Arbitrary for Rc<str> and Arc<str>

    Changed

    • Allow overriding the error type in arbitrary::Result
    • The Unstructured::arbitrary_loop method will consume fewer bytes of input now.

    Fixed

    • Fixed a bug where Unstructured::int_in_range could return out-of-range integers.

    Open source →
  14. 1.1.3 23 Jun 2022
    Release notes

    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

    Open source →
  15. 1.1.2 16 Jun 2022
    Release notes

    Released 2022-06-16.

    Fixed

    • Fixed a warning inside derive(Arbitrary)-generated code. #110

    Open source →
  16. 1.1.1 14 Jun 2022
    Release notes

    Released 2022-06-14.

    Fixed

    • Fixed a stack overflow when using derive(Arbitrary) with recursive types and empty inputs. #109

    Open source →
  17. 1.1.0 10 Feb 2022
    Release notes

    Released 2022-02-09.

    Added

    • Added the Unstructured::ratio method to generate a boolean that is true at the given rate.

    • Added the Unstructured::arbitrary_loop method to call a function an arbitrary number of times.


    Open source →
  18. 1.0.3 15 Nov 2021
    Release notes

    Released 2021-11-20.

    Fixed

    • Fixed documentation for Unstructured::fill_bytes. We forgot to update this way back in #53 when the behavior changed.

    Open source →
  19. 1.0.2 26 Aug 2021
    Release notes

    Released 2021-08-25.

    Added

    • Arbitrary impls for HashMaps and HashSets with custom Hashers #87

    Open source →
  20. 1.0.1 20 May 2021
    Release notes

    Released 2021-05-20.

    Added

    • Arbitrary impls for NonZeroX types #79
    • Arbitrary impls for all arrays using const generics #55
    • Arbitrary impls for Ipv4Addr and Ipv6Addr #84

    Fixed

    • Use fewer bytes for Unstructured::int_in_range() #80
    • Use correct range for char generation #83

    Open source →
  21. 1.0.0 24 Feb 2021
    Release notes

    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.


    Open source →
  22. 1.0.0-rc2 09 Feb 2021 pre-release
    Release notes

    Released 2021-02-09.

    Added

    • The Arbitrary trait is now implemented for &[u8]. #67

    Changed

    • Rename Unstructured#get_bytes to Unstructured#bytes. #70
    • Passing an empty slice of choices to Unstructured#choose returns an error. Previously it would panic. 71

    Open source →
  23. 1.0.0-rc1 26 Nov 2020 pre-release
    Release notes

    Released 2020-11-25.

    Added

    • The Arbitrary trait is now implemented for &str. #63

    Changed

    • The Arbitrary trait now has a lifetime parameter, allowing Arbitrary implementations that borrow from the raw input (e.g. the new &str implementaton). The derive(Arbitrary) macro also supports deriving Arbitrary on types with lifetimes now. #63

    Removed

    • The shrink method on the Arbitrary trait 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 the T: Arbitrary type 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 the Arbitrary::shrink method. If you are using and relying on the Arbitrary::shrink method, 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 the arbitrary crate.


    Open source →
  24. 0.4.7 14 Oct 2020
    Release notes

    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 Arbitrary implementation for std::time::Duration should now be faster and produce durations with a more-uniform distribution of nanoseconds.

    Open source →
  25. 0.4.6 22 Aug 2020
    Release notes

    Released 2020-08-22.

    Added

    • Added the Unstructured::peek_bytes method.

    Changed

    • Test case reduction via cargo fuzz tmin should 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)


    Open source →
  26. 0.4.5 18 Jun 2020
    Release notes

    Released 2020-06-18.

    Added

    • Implement Arbitrary for zero length arrays.
    • Implement Arbitrary for Range and RangeInclusive.

    Open source →
  27. 0.4.4 29 Apr 2020
    Release notes

    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)]).
    Open source →
  28. 0.4.3 28 Apr 2020
    Release notes

    Released 2020-04-28.

    Fixed

    • Fixed the custom derive when used via its full path (like #[derive(arbitrary::Arbitrary)] rather than like #[derive(Arbitrary)]).

    Open source →
  29. 0.4.2 17 Apr 2020
    Release notes

    Released 2020-04-17.

    Changed

    • We forgot to release a new version of the derive_arbitrary crate last release. This release fixes that and so the synstructure dependency is finally actually removed in the cargo releases.

    Open source →
  30. 0.4.1 18 Mar 2020
    Release notes

    Released 2020-03-18.

    Removed

    • Removed an internal dependency on the synstructure crate when the derive feature is enabled. This should not have any visible downstream effects other than faster build times!

    Open source →
  31. 0.4.0 22 Jan 2020
    Release notes

    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_hint method by hand. If so, see the "changed" section below and the API docs for Arbitrary::shrink for details.

    Added

    Changed

    • The Arbitrary::size_hint signature now takes a depth: usize parameter. This should be passed along unmodified to any nested calls of other size_hint methods. If you're implementing size_hint for a recursive type (like a linked list or tree) or a generic type with type parameters, you should use the new arbitrary::size_hint::recursion_guard helper function.

    Fixed

    • Fixed infinite recursion in generated size_hint implementations from #[derive(Arbitrary)] for recursive types.

    Open source →
  32. 0.3.3 16 Jan 2020

    Nothing published for this version

  33. 0.3.2 16 Jan 2020
    Release notes

    Released 2020-01-16.

    Changed

    • Updated the custom derive's dependencies.

    Open source →
  34. 0.3.1 14 Jan 2020
    Release notes

    Released 2020-01-14.

    Fixed

    • Fixed some links and version numbers in README.

    Open source →
  35. 0.3.0 14 Jan 2020
    Release notes

    Released 2020-01-14.

    Added

    • Added the "derive" cargo feature, to enable #[derive(Arbitrary)] for custom types. Enabling this feature re-exports functionality from the derive_arbitrary crate.
    • The custom derive for Arbitrary implements the shrink method for you now.
    • All implementations of Arbitrary for std types implement shrinking now.
    • Added the Arbitrary::arbitrary_take_rest method allows an Arbitrary implementation to consume all of the rest of the remaining raw input. It has a default implementation that forwards to Arbitrary::arbitrary and the custom derive creates a smart implementation for your custom types.
    • Added the Arbitrary::size_hint method 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::choose method to choose one thing among a set of choices.
    • Added the Unstructured::arbitrary_len method to get an arbitrary length for a collection of some arbitrary type.
    • Added the Unstructured::arbitrary_iter method to create an iterator of arbitrary instance of some type.

    Changed

    • The Arbitrary trait was simplified a bit.
    • Unstructured is a concrete type now, not a trait.
    • Switched to Rust 2018 edition.

    Removed

    • RingBuffer and FiniteBuffer are removed. Use Unstructured instead.

    Fixed

    • Better Arbitrary implementation for char.
    • Better Arbitrary implementation for String.

    Open source →
  36. 0.2.0 17 Sep 2018
    Release notes

    Open source →
  37. 0.1.1 03 Apr 2018

    Nothing published for this version

  38. 0.1.0 08 May 2017

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive