Skip to content

Commit 803f2df

Browse files
authored
Merge pull request #175 from benluelo/arbitrary-bound-attribute
docs: mention `arbitrary(bound = "...")` container attribute in trait docs
2 parents 37ccb7d + 8471f01 commit 803f2df

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ use std::sync::{Arc, Mutex};
9696
///
9797
/// Every member of the `struct` or `enum` must also implement `Arbitrary`.
9898
///
99+
/// It is also possible to change the default bounds added by the derive:
100+
///
101+
/// ```
102+
/// # #[cfg(feature = "derive")] mod foo {
103+
/// use arbitrary::Arbitrary;
104+
///
105+
/// trait Trait {
106+
/// type Assoc: for<'a> Arbitrary<'a>;
107+
/// }
108+
///
109+
/// #[derive(Arbitrary)]
110+
/// // The bounds are used verbatim, so any existing trait bounds will need to be repeated.
111+
/// #[arbitrary(bound = "T: Trait")]
112+
/// struct Point<T: Trait> {
113+
/// x: T::Assoc,
114+
/// }
115+
/// # }
116+
/// ```
117+
///
99118
/// # Implementing `Arbitrary` By Hand
100119
///
101120
/// Implementing `Arbitrary` mostly involves nested calls to other `Arbitrary`

0 commit comments

Comments
 (0)