Description
The field function_pointer
in struct GuestFunctionDefinition
is defined as a i64.
This requires that a function pointer passed to register_function
is cast to i64
When running clippy on a guest that casts from a func directly to i64 (e.g. myfunc as i64
) results in the clippy error "casting function pointer myfunc
to i64
" and the suggested fix "try: myfunc as usize
" which does not work.
The options are to disable the clippy check ([allow(clippy::fn_to_numeric_cast)]
) or to double cast the pointer (e.g. myfunc as *const() as i64
or myfunc as usize as i64
).
Should the definition of the field function pointer be changed to either usize
or fn(&FunctionCall) -> Result<Vec<u8>>