Struct detour::StaticDetourController
[−]
[src]
pub struct StaticDetourController<T: Function> { /* fields omitted */ }
An instantiator for StaticDetour.
This is the type used by the static_detours! macro, it cannot be created without it.
Methods
impl<T: Function> StaticDetourController<T>
[src]
unsafe fn initialize<C>(&self, target: T, closure: C) -> Result<StaticDetour<T>> where
C: Fn<T::Arguments, Output = T::Output> + Send + 'static,
C: Fn<T::Arguments, Output = T::Output> + Send + 'static,
Creates a StaticDetour initialized with a target and a closure.
If the detour has already been initialized, but it has not gone out of
scope, an AlreadyExisting
error will be thrown.
unsafe fn get(&self) -> Option<&GenericDetour<T>>
Returns a reference to the underlying detour.
It is mostly provided so the original function can easily be called within a detour.
This is unsafe because the lifetime of the detour has no relation to the
actual detour returned by initialize
. Therefore it can be dropped at
any time. Prefer to use the handle returned from initialize
whenever
possible.