@@ -13,12 +13,9 @@ pub struct FunctionEnv<T> {
13
13
marker : PhantomData < T > ,
14
14
}
15
15
16
- impl < T > FunctionEnv < T > {
16
+ impl < T : Any > FunctionEnv < T > {
17
17
/// Make a new FunctionEnv
18
- pub fn new ( store : & mut impl AsStoreMut , value : T ) -> Self
19
- where
20
- T : Any + Send + ' static + Sized ,
21
- {
18
+ pub fn new ( store : & mut impl AsStoreMut , value : T ) -> Self {
22
19
Self {
23
20
handle : StoreHandle :: new (
24
21
store. as_store_mut ( ) . objects_mut ( ) ,
@@ -29,10 +26,7 @@ impl<T> FunctionEnv<T> {
29
26
}
30
27
31
28
/// Get the data as reference
32
- pub fn as_ref < ' a > ( & self , store : & ' a impl AsStoreRef ) -> & ' a T
33
- where
34
- T : Any + Send + ' static + Sized ,
35
- {
29
+ pub fn as_ref < ' a > ( & self , store : & ' a impl AsStoreRef ) -> & ' a T {
36
30
self . handle
37
31
. get ( store. as_store_ref ( ) . objects ( ) )
38
32
. as_ref ( )
@@ -49,10 +43,7 @@ impl<T> FunctionEnv<T> {
49
43
}
50
44
51
45
/// Get the data as mutable
52
- pub fn as_mut < ' a > ( & self , store : & ' a mut impl AsStoreMut ) -> & ' a mut T
53
- where
54
- T : Any + Send + ' static + Sized ,
55
- {
46
+ pub fn as_mut < ' a > ( & self , store : & ' a mut impl AsStoreMut ) -> & ' a mut T {
56
47
self . handle
57
48
. get_mut ( store. objects_mut ( ) )
58
49
. as_mut ( )
@@ -61,10 +52,7 @@ impl<T> FunctionEnv<T> {
61
52
}
62
53
63
54
/// Convert it into a `FunctionEnvMut`
64
- pub fn into_mut ( self , store : & mut impl AsStoreMut ) -> FunctionEnvMut < T >
65
- where
66
- T : Any + Send + ' static + Sized ,
67
- {
55
+ pub fn into_mut ( self , store : & mut impl AsStoreMut ) -> FunctionEnvMut < T > {
68
56
FunctionEnvMut {
69
57
store_mut : store. as_store_mut ( ) ,
70
58
func_env : self ,
@@ -102,16 +90,13 @@ pub struct FunctionEnvMut<'a, T: 'a> {
102
90
pub ( crate ) func_env : FunctionEnv < T > ,
103
91
}
104
92
105
- impl < ' a , T > Debug for FunctionEnvMut < ' a , T >
106
- where
107
- T : Send + Debug + ' static ,
108
- {
93
+ impl < ' a , T : Debug + ' static > Debug for FunctionEnvMut < ' a , T > {
109
94
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
110
95
self . func_env . as_ref ( & self . store_mut ) . fmt ( f)
111
96
}
112
97
}
113
98
114
- impl < T : Send + ' static > FunctionEnvMut < ' _ , T > {
99
+ impl < T : ' static > FunctionEnvMut < ' _ , T > {
115
100
/// Returns a reference to the host state in this function environement.
116
101
pub fn data ( & self ) -> & T {
117
102
self . func_env . as_ref ( & self . store_mut )
0 commit comments