Skip to main content

FnAddr

Trait FnAddr 

Source
pub unsafe trait FnAddr: Copy {
    // Required method
    fn as_ptr(self) -> NonNull<Code>;

    // 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 and function definition types

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>.

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§