1
1
use crate :: error:: { Error , Result } ;
2
2
use crate :: { Function , GenericDetour } ;
3
+ use std:: marker:: Tuple ;
3
4
use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
4
5
use std:: { mem, ptr} ;
5
6
@@ -104,6 +105,7 @@ impl<T: Function> StaticDetour<T> {
104
105
pub unsafe fn initialize < D > ( & self , target : T , closure : D ) -> Result < & Self >
105
106
where
106
107
D : Fn < T :: Arguments , Output = T :: Output > + Send + ' static ,
108
+ <T as Function >:: Arguments : Tuple ,
107
109
{
108
110
let mut detour = Box :: new ( GenericDetour :: new ( target, self . ffi ) ?) ;
109
111
if self
@@ -155,6 +157,7 @@ impl<T: Function> StaticDetour<T> {
155
157
pub fn set_detour < C > ( & self , closure : C )
156
158
where
157
159
C : Fn < T :: Arguments , Output = T :: Output > + Send + ' static ,
160
+ <T as Function >:: Arguments : Tuple ,
158
161
{
159
162
let previous = self
160
163
. closure
@@ -175,7 +178,10 @@ impl<T: Function> StaticDetour<T> {
175
178
176
179
/// Returns a transient reference to the active detour.
177
180
#[ doc( hidden) ]
178
- pub fn __detour ( & self ) -> & dyn Fn < T :: Arguments , Output = T :: Output > {
181
+ pub fn __detour ( & self ) -> & dyn Fn < T :: Arguments , Output = T :: Output >
182
+ where
183
+ <T as Function >:: Arguments : Tuple ,
184
+ {
179
185
// TODO: This is not 100% thread-safe in case the thread is stopped
180
186
unsafe { self . closure . load ( Ordering :: SeqCst ) . as_ref ( ) }
181
187
. ok_or ( Error :: NotInitialized )
0 commit comments