MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / new

Method new

crates/test-util/src/component_fuzz.rs:83–99  ·  view source on GitHub ↗
(
        input: &mut Unstructured<'a>,
        fuel: &mut u32,
        generate: impl Fn(&mut Unstructured<'a>, &mut u32) -> arbitrary::Result<T>,
    )

Source from the content-addressed store, hash-verified

81
82impl<T, const L: u32, const H: u32> VecInRange<T, L, H> {
83 fn new<'a>(
84 input: &mut Unstructured<'a>,
85 fuel: &mut u32,
86 generate: impl Fn(&mut Unstructured<'a>, &mut u32) -> arbitrary::Result<T>,
87 ) -> arbitrary::Result<Self> {
88 let mut ret = Vec::new();
89 input.arbitrary_loop(Some(L), Some(H), |input| {
90 if *fuel > 0 {
91 *fuel = *fuel - 1;
92 ret.push(generate(input, fuel)?);
93 Ok(std::ops::ControlFlow::Continue(()))
94 } else {
95 Ok(std::ops::ControlFlow::Break(()))
96 }
97 })?;
98 Ok(Self(ret))
99 }
100}
101
102impl<T, const L: u32, const H: u32> Deref for VecInRange<T, L, H> {

Callers

nothing calls this directly

Calls 4

OkFunction · 0.85
newFunction · 0.50
generateFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected