Function wasmtime_environ::__core::mem::copy
source · pub const fn copy<T>(x: &T) -> Twhere
T: Copy,
🔬This is a nightly-only experimental API. (
mem_copy_fn
)Expand description
Bitwise-copies a value.
This function is not magic; it is literally defined as
pub fn copy<T: Copy>(x: &T) -> T { *x }
It is useful when you want to pass a function pointer to a combinator, rather than defining a new closure.
Example:
#![feature(mem_copy_fn)]
use core::mem::copy;
let result_from_ffi_function: Result<(), &i32> = Err(&1);
let result_copied: Result<(), i32> = result_from_ffi_function.map_err(copy);