11use crate :: mock_store:: { MockLayer , MockStore } ;
2- use std:: any:: { Any , TypeId } ;
2+ use std:: { any:: { Any , TypeId } , marker :: Tuple } ;
33use std:: marker:: PhantomData ;
44use std:: mem:: transmute;
55
@@ -8,7 +8,7 @@ use std::mem::transmute;
88/// The trait is implemented for all functions, so its methods can be called on any function.
99///
1010/// Note: methods have any effect only if called on functions [annotated as mockable](https://docs.rs/mocktopus_macros).
11- pub trait Mockable < T , O > {
11+ pub trait Mockable < T : Tuple , O > {
1212 /// Core function for setting up mocks
1313 ///
1414 /// Always consider using [mock_safe](#tymethod.mock_safe) or [MockContext](struct.MockContext.html).
@@ -97,7 +97,7 @@ pub fn clear_mocks() {
9797 MOCK_STORE . with ( |mock_store| mock_store. clear ( ) )
9898}
9999
100- impl < T , O , F : FnOnce < T , Output = O > > Mockable < T , O > for F {
100+ impl < T : Tuple , O , F : FnOnce < T , Output = O > > Mockable < T , O > for F {
101101 unsafe fn mock_raw < M : FnMut < T , Output = MockResult < T , O > > > ( & self , mock : M ) {
102102 let id = self . get_mock_id ( ) ;
103103 let boxed = Box :: new ( mock) as Box < dyn FnMut < _ , Output = _ > > ;
@@ -186,7 +186,7 @@ impl<'a> MockContext<'a> {
186186 ///
187187 /// This function doesn't actually mock the function. It registers it as a
188188 /// function that will be mocked when [`run`](#method.run) is called.
189- pub fn mock_safe < I , O , F , M > ( self , mockable : F , mock : M ) -> Self
189+ pub fn mock_safe < I : Tuple , O , F , M > ( self , mockable : F , mock : M ) -> Self
190190 where
191191 F : Mockable < I , O > ,
192192 M : FnMut < I , Output = MockResult < I , O > > + ' a ,
@@ -198,7 +198,7 @@ impl<'a> MockContext<'a> {
198198 ///
199199 /// This is an unsafe version of [`mock_safe`](#method.mock_safe),
200200 /// without lifetime constraint on mock
201- pub unsafe fn mock_raw < I , O , F , M > ( mut self , mockable : F , mock : M ) -> Self
201+ pub unsafe fn mock_raw < I : Tuple , O , F , M > ( mut self , mockable : F , mock : M ) -> Self
202202 where
203203 F : Mockable < I , O > ,
204204 M : FnMut < I , Output = MockResult < I , O > > ,
0 commit comments