Skip to content

Commit 864f11d

Browse files
authored
Merge pull request #167 from wackbyte/arbitrary-for-phantompinned
Implement `Arbitrary` for `PhantomPinned`
2 parents 7ea39f1 + 5adb4a9 commit 864f11d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,17 @@ impl<'a, A: Arbitrary<'a>> Arbitrary<'a> for ::std::marker::PhantomData<A> {
11081108
}
11091109
}
11101110

1111+
impl<'a> Arbitrary<'a> for ::std::marker::PhantomPinned {
1112+
fn arbitrary(_: &mut Unstructured<'a>) -> Result<Self> {
1113+
Ok(::std::marker::PhantomPinned)
1114+
}
1115+
1116+
#[inline]
1117+
fn size_hint(_depth: usize) -> (usize, Option<usize>) {
1118+
(0, Some(0))
1119+
}
1120+
}
1121+
11111122
impl<'a, A: Arbitrary<'a>> Arbitrary<'a> for ::std::num::Wrapping<A> {
11121123
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self> {
11131124
Arbitrary::arbitrary(u).map(::std::num::Wrapping)

0 commit comments

Comments
 (0)