MCPcopy Create free account
hub / github.com/Lokathor/tinyvec / arbitrary

Method arbitrary

src/arrayvec.rs:271–279  ·  view source on GitHub ↗
(u: &mut arbitrary::Unstructured<'a>)

Source from the content-addressed store, hash-verified

269 A::Item: arbitrary::Arbitrary<'a>,
270{
271 fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {
272 let max_len = A::CAPACITY.min(u16::MAX as usize) as u16;
273 let len = u.int_in_range::<u16>(0..=max_len)?;
274 let mut self_: Self = Default::default();
275 for _ in 0..len {
276 self_.push(u.arbitrary()?);
277 }
278 Ok(self_)
279 }
280
281 fn size_hint(depth: usize) -> (usize, Option<usize>) {
282 arbitrary::size_hint::recursion_guard(depth, |depth| {

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected