From 8471f011e265e77ab61918c38dfb26c542fc206d Mon Sep 17 00:00:00 2001 From: benluelo Date: Sun, 28 Jan 2024 21:32:35 -0500 Subject: [PATCH] docs: mention `arbitrary(bound = "...")` container attribute in trait docs --- src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c362ca8..7270364 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,6 +96,25 @@ use std::sync::{Arc, Mutex}; /// /// Every member of the `struct` or `enum` must also implement `Arbitrary`. /// +/// It is also possible to change the default bounds added by the derive: +/// +/// ``` +/// # #[cfg(feature = "derive")] mod foo { +/// use arbitrary::Arbitrary; +/// +/// trait Trait { +/// type Assoc: for<'a> Arbitrary<'a>; +/// } +/// +/// #[derive(Arbitrary)] +/// // The bounds are used verbatim, so any existing trait bounds will need to be repeated. +/// #[arbitrary(bound = "T: Trait")] +/// struct Point { +/// x: T::Assoc, +/// } +/// # } +/// ``` +/// /// # Implementing `Arbitrary` By Hand /// /// Implementing `Arbitrary` mostly involves nested calls to other `Arbitrary`