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

Function get_function_name

cranelift/interpreter/src/environment.rs:64–74  ·  view source on GitHub ↗

Retrieve a function name from a [FuncRef] within a [Function]. TODO this should be optimized, if possible, as currently it retrieves the function name as a string and performs string matching.

(func_ref: FuncRef, function: &Function)

Source from the content-addressed store, hash-verified

62/// Retrieve a function name from a [FuncRef] within a [Function]. TODO this should be optimized, if possible, as
63/// currently it retrieves the function name as a string and performs string matching.
64fn get_function_name(func_ref: FuncRef, function: &Function) -> String {
65 function
66 .stencil
67 .dfg
68 .ext_funcs
69 .get(func_ref)
70 .expect("function to exist")
71 .name
72 .display(Some(&function.params))
73 .to_string()
74}
75
76#[cfg(test)]
77mod tests {

Callers 1

get_from_func_refMethod · 0.85

Calls 4

to_stringMethod · 0.45
displayMethod · 0.45
expectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected