Skip to main content

FunctionPointer

Trait FunctionPointer 

Source
pub trait FunctionPointer:
    Primitive
    + Copy
    + Sized {
    type Args: Tuple;
    type Return;

    // Required methods
    fn call(self, args: Self::Args) -> Self::Return;
    fn cast_ptr<T: Sized, P: Pointer<T>>(self) -> P;
    fn cast_int<T: Integer>(self) -> T;
}

Required Associated Types§

Required Methods§

Source

fn call(self, args: Self::Args) -> Self::Return

Source

fn cast_ptr<T: Sized, P: Pointer<T>>(self) -> P

Source

fn cast_int<T: Integer>(self) -> T

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<A1, R> FunctionPointer for fn(A1₁, A1₂, …, A1ₙ) -> R

This trait is implemented for function pointers with up to 12 arguments.

Source§

type Args = (A1,)

Source§

type Return = R

Source§

fn call(self, args: Self::Args) -> Self::Return

Source§

fn cast_ptr<T: Sized, P: Pointer<T>>(self) -> P

Source§

fn cast_int<T: Integer>(self) -> T

Source§

impl<R> FunctionPointer for fn() -> R

Source§

type Args = ()

Source§

type Return = R

Source§

fn call(self, _args: Self::Args) -> Self::Return

Source§

fn cast_ptr<T: Sized, P: Pointer<T>>(self) -> P

Source§

fn cast_int<T: Integer>(self) -> T

Implementors§