From 1b6a04ca5504955c571d1c97504fb45ea0befee4 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 8 Jan 2024 01:21:28 +0400 Subject: Initial vendor packages Signed-off-by: Valentin Popov --- vendor/smallvec/src/arbitrary.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 vendor/smallvec/src/arbitrary.rs (limited to 'vendor/smallvec/src/arbitrary.rs') diff --git a/vendor/smallvec/src/arbitrary.rs b/vendor/smallvec/src/arbitrary.rs new file mode 100644 index 0000000..cbdfcb0 --- /dev/null +++ b/vendor/smallvec/src/arbitrary.rs @@ -0,0 +1,19 @@ +use crate::{Array, SmallVec}; +use arbitrary::{Arbitrary, Unstructured}; + +impl<'a, A: Array> Arbitrary<'a> for SmallVec +where + ::Item: Arbitrary<'a>, +{ + fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result { + u.arbitrary_iter()?.collect() + } + + fn arbitrary_take_rest(u: Unstructured<'a>) -> arbitrary::Result { + u.arbitrary_take_rest_iter()?.collect() + } + + fn size_hint(depth: usize) -> (usize, Option) { + arbitrary::size_hint::and(::size_hint(depth), (0, None)) + } +} -- cgit v1.2.3