Trait FnPtr

pub trait FnPtr: Copy

A common trait implemented by all function pointers.

Required Methods

fn as_ptr(self) -> NonNull<Code>

Returns the function pointer as a [NonNull<Code>].

unsafe fn from_ptr(ptr: NonNull<Code>) -> Self

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

fn addr(self) -> usize

Returns the address of the function pointer.