SafeFnPtr

Trait SafeFnPtr 

Source
pub trait SafeFnPtr: FnPtr {
    // Required method
    fn invoke(&self, args: Self::Args) -> Self::Output;
}
Expand description

Marker trait for all safe function pointer types (fn / extern fn).

Required Methods§

Source

fn invoke(&self, args: Self::Args) -> Self::Output

Invokes the function pointed to with the given args.

§Examples
fn add(a: i32, b: i32) -> i32 { a + b }

let f: fn(i32, i32) -> i32 = add;
let result = f.invoke((2, 3));
assert_eq!(result, 5);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Ret: 'static> SafeFnPtr for fn() -> Ret

Source§

fn invoke(&self, (): Self::Args) -> Self::Output

Source§

impl<Ret: 'static> SafeFnPtr for extern "C" fn() -> Ret

Source§

fn invoke(&self, (): Self::Args) -> Self::Output

Source§

impl<Ret: 'static> SafeFnPtr for extern "system" fn() -> Ret

Source§

fn invoke(&self, (): Self::Args) -> Self::Output

Source§

impl<Ret: 'static> SafeFnPtr for extern "sysv64" fn() -> Ret

Source§

fn invoke(&self, (): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static> SafeFnPtr for fn(A) -> Ret

Source§

fn invoke(&self, (__arg_0): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static> SafeFnPtr for extern "C" fn(A) -> Ret

Source§

fn invoke(&self, (__arg_0): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static> SafeFnPtr for extern "system" fn(A) -> Ret

Source§

fn invoke(&self, (__arg_0): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static> SafeFnPtr for extern "sysv64" fn(A) -> Ret

Source§

fn invoke(&self, (__arg_0): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static> SafeFnPtr for fn(A, B) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static> SafeFnPtr for extern "C" fn(A, B) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static> SafeFnPtr for extern "system" fn(A, B) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static> SafeFnPtr for extern "sysv64" fn(A, B) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static> SafeFnPtr for fn(A, B, C) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1, __arg_2): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static> SafeFnPtr for extern "C" fn(A, B, C) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1, __arg_2): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static> SafeFnPtr for extern "system" fn(A, B, C) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1, __arg_2): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static> SafeFnPtr for extern "sysv64" fn(A, B, C) -> Ret

Source§

fn invoke(&self, (__arg_0, __arg_1, __arg_2): Self::Args) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static> SafeFnPtr for fn(A, B, C, D) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static> SafeFnPtr for extern "C" fn(A, B, C, D) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static> SafeFnPtr for extern "system" fn(A, B, C, D) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static> SafeFnPtr for extern "sysv64" fn(A, B, C, D) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static> SafeFnPtr for fn(A, B, C, D, E) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static> SafeFnPtr for extern "C" fn(A, B, C, D, E) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static> SafeFnPtr for extern "system" fn(A, B, C, D, E) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static> SafeFnPtr for extern "sysv64" fn(A, B, C, D, E) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static> SafeFnPtr for fn(A, B, C, D, E, F) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4, __arg_5): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static> SafeFnPtr for extern "C" fn(A, B, C, D, E, F) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4, __arg_5): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static> SafeFnPtr for extern "system" fn(A, B, C, D, E, F) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4, __arg_5): Self::Args, ) -> Self::Output

Source§

impl<Ret: 'static, A: 'static, B: 'static, C: 'static, D: 'static, E: 'static, F: 'static> SafeFnPtr for extern "sysv64" fn(A, B, C, D, E, F) -> Ret

Source§

fn invoke( &self, (__arg_0, __arg_1, __arg_2, __arg_3, __arg_4, __arg_5): Self::Args, ) -> Self::Output

Implementors§