11use crate :: error:: { Error , Result } ;
22use crate :: { Function , GenericDetour } ;
3+ use std:: marker:: Tuple ;
34use std:: sync:: atomic:: { AtomicPtr , Ordering } ;
45use std:: { mem, ptr} ;
56
@@ -104,6 +105,7 @@ impl<T: Function> StaticDetour<T> {
104105 pub unsafe fn initialize < D > ( & self , target : T , closure : D ) -> Result < & Self >
105106 where
106107 D : Fn < T :: Arguments , Output = T :: Output > + Send + ' static ,
108+ <T as Function >:: Arguments : Tuple ,
107109 {
108110 let mut detour = Box :: new ( GenericDetour :: new ( target, self . ffi ) ?) ;
109111 if self
@@ -155,6 +157,7 @@ impl<T: Function> StaticDetour<T> {
155157 pub fn set_detour < C > ( & self , closure : C )
156158 where
157159 C : Fn < T :: Arguments , Output = T :: Output > + Send + ' static ,
160+ <T as Function >:: Arguments : Tuple ,
158161 {
159162 let previous = self
160163 . closure
@@ -175,7 +178,10 @@ impl<T: Function> StaticDetour<T> {
175178
176179 /// Returns a transient reference to the active detour.
177180 #[ 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+ {
179185 // TODO: This is not 100% thread-safe in case the thread is stopped
180186 unsafe { self . closure . load ( Ordering :: SeqCst ) . as_ref ( ) }
181187 . ok_or ( Error :: NotInitialized )
0 commit comments