Struct minhook::StaticHookWithDefault
[−]
[src]
pub struct StaticHookWithDefault<T: Function> { // some fields omitted }
A hook with a static lifetime and a default detour closure.
This hook can only be constructed using the static_hooks!
macro. It has one of the
following forms:
#[ATTR]* pub? impl HOOK_VAR_NAME for PATH::TO::TARGET: FN_TYPE = CLOSURE_EXPR; #[ATTR]* pub? impl HOOK_VAR_NAME for "FUNCTION" in "MODULE": FN_TYPE = CLOSURE_EXPR;
Before accessing this hook it is required to call initialize()
. Accessing the hook
before initializing or trying to initialize the hook more than once will result in a panic.
Methods
impl<T: Function> StaticHookWithDefault<T>
[src]
unsafe fn initialize(&self) -> Result<()>
Initialize and install the underlying hook.
Panics
Panics if the hook was already initialized.
Safety
See documentation for Hook::create()
and
Hook::create_api()
Methods from Deref<Target=StaticHook<T>>
fn trampoline(&self) -> T
Returns a reference to the trampoline function.
unsafe fn initialize<F>(&self, closure: F) -> Result<()> where F: Fn<T::Args, Output=T::Output> + Sync + 'static
Initialize and install the underlying hook using a detour closure.
Panics
Panics if the hook was already initialized.
Safety
See documentation for Hook::create()
and
Hook::create_api()
Trait Implementations
impl<T: Function> Deref for StaticHookWithDefault<T>
[src]
type Target = StaticHook<T>
The resulting type after dereferencing
fn deref(&self) -> &StaticHook<T>
The method called to dereference a value