Struct r3_core::closure::ClosureEnv
source · #[repr(transparent)]pub struct ClosureEnv(_);
Expand description
The environment parameter type for Closure
. It’s ABI-compatible with
*mut ()
but might not be fully initialized.
It’s something that would usually be just intptr_t
or void *
in C code.
It’s designed to have the following properties:
-
It’s ABI-compatible with a C pointer, making it possible to pass the components of a
Closure
to kernel implementations written in inline assembly or other languages without needing to wrap it with another trampoline. -
Unlike
dyn FnOnce()
, it doesn’t waste memory for vtable, most entries of which will never be used for static closures. -
Constructing it from a pointer doens’t require a pointer-to-integer cast, which is disallowed in a constant context.
Currently it must be filled with initialized bytes because of compiler restrictions. This may change in the future.
Trait Implementations§
source§impl Clone for ClosureEnv
impl Clone for ClosureEnv
source§fn clone(&self) -> ClosureEnv
fn clone(&self) -> ClosureEnv
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more