UnsafeFnPtr

Trait UnsafeFnPtr 

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

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

Required Methods§

Source

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

Invokes the function pointed to with the given args.

§Safety

Calling this function pointer is unsafe because the function may have invariants that must be manually upheld by the caller.

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

let f: unsafe fn(*const i32, *const i32) -> i32 = add;
let result = unsafe { 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> UnsafeFnPtr for unsafe fn() -> Ret

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

unsafe 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> UnsafeFnPtr for unsafe fn(A, B, C, D) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "C" fn(A, B, C, D) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "system" fn(A, B, C, D) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "sysv64" fn(A, B, C, D) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe fn(A, B, C, D, E) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "C" fn(A, B, C, D, E) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "system" fn(A, B, C, D, E) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "sysv64" fn(A, B, C, D, E) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe fn(A, B, C, D, E, F) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "C" fn(A, B, C, D, E, F) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "system" fn(A, B, C, D, E, F) -> Ret

Source§

unsafe 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> UnsafeFnPtr for unsafe extern "sysv64" fn(A, B, C, D, E, F) -> Ret

Source§

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

Implementors§