FnPtr in core::ops - Rust
Skip to main content FnPtr core :: ops Trait FnPtr Source pub trait FnPtr: Copy { // Required methods fn as_ptr (self) -> NonNull < Code >; unsafe fn from_ptr (ptr: NonNull < Code >) -> Self; // Provided method fn addr (self) -> usize { ... } } 🔬 This is a nightly-only experimental API. ( fn_static #148768 ) Expand description A common trait implemented by all function pointers. Required Methods § Source fn as_ptr (self) -> NonNull < Code > 🔬 This is a nightly-only experimental API. ( fn_static #148768 ) Returns the function pointer as a NonNull<Code> .
Source unsafe fn from_ptr (ptr: NonNull < Code >) -> Self 🔬 This is a nightly-only experimental API. ( fn_static #148768 ) Constructs a function pointer from a NonNull pointer. § Safety The function pointer must have been obtained from an FnPtr::as_ptr call from a function pointer type that is ABI compatible. Provided Methods § Source fn addr (self) -> usize 🔬 This is a nightly-only experimental API. ( fn_static #148768 ) Returns the address of the function pointer.
Dyn Compatibility § This trait is not dyn compatible . In older versions of Rust, dyn compatibility was called "object safety". Implementors §