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

Function translate_args

crates/c-api/src/func.rs:121–133  ·  view source on GitHub ↗

Places the `args` into `dst` and additionally reserves space in `dst` for `results_size` returns. The params/results slices are then returned separately.

(
    dst: &'a mut Vec<Val>,
    args: impl ExactSizeIterator<Item = Val>,
    results_size: usize,
)

Source from the content-addressed store, hash-verified

119/// Places the `args` into `dst` and additionally reserves space in `dst` for `results_size`
120/// returns. The params/results slices are then returned separately.
121pub(crate) fn translate_args<'a>(
122 dst: &'a mut Vec<Val>,
123 args: impl ExactSizeIterator<Item = Val>,
124 results_size: usize,
125) -> (&'a [Val], &'a mut [Val]) {
126 debug_assert!(dst.is_empty());
127 let num_args = args.len();
128 dst.reserve(args.len() + results_size);
129 dst.extend(args);
130 dst.extend((0..results_size).map(|_| Val::null_func_ref()));
131 let (a, b) = dst.split_at_mut(num_args);
132 (a, b)
133}
134
135#[unsafe(no_mangle)]
136pub unsafe extern "C" fn wasm_func_call(

Callers 3

wasm_func_callFunction · 0.85
wasmtime_func_callFunction · 0.85
do_func_call_asyncFunction · 0.85

Calls 4

lenMethod · 0.45
reserveMethod · 0.45
extendMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected