Trait minhook::function::Function [] [src]

pub unsafe trait Function: Sized + Copy + Sync + 'static {
    type Unsafe: UnsafeFunction<Args=Self::Args, Output=Self::Output>;
    type Args;
    type Output;

    const ARITY: usize;

    unsafe fn from_ptr(ptr: FnPointer) -> Self;
    fn to_ptr(&self) -> FnPointer;
    fn to_unsafe(&self) -> Self::Unsafe;
}

Trait representing a function that can be used as a target function or detour function for hooking.

Associated Types

type Unsafe: UnsafeFunction<Args=Self::Args, Output=Self::Output>

Unsafe version of this function.

type Args

The argument types as a tuple.

type Output

The return type.

Associated Constants

const ARITY: usize

The function's arity (number of arguments).

Required Methods

unsafe fn from_ptr(ptr: FnPointer) -> Self

Constructs a Function from an untyped function pointer.

Safety

This function is unsafe because it can not check if the argument points to a function of the correct type.

fn to_ptr(&self) -> FnPointer

Returns a untyped function pointer for this function.

fn to_unsafe(&self) -> Self::Unsafe

Returns this function as its unsafe variant.

Implementors