@@ -11,10 +11,10 @@ use crate::{
1111 types:: { boxed:: private:: JsBoxInner , private:: ValueInternal , Value } ,
1212} ;
1313
14- type BoxAny = Box < dyn Any + Send + ' static > ;
14+ type BoxAny = Box < dyn Any + ' static > ;
1515
1616mod private {
17- pub struct JsBoxInner < T : Send + ' static > {
17+ pub struct JsBoxInner < T : ' static > {
1818 pub ( super ) local : crate :: sys:: raw:: Local ,
1919 // Cached raw pointer to the data contained in the `JsBox`. This value is
2020 // required to implement `Deref` for `JsBox`. Unlike most `Js` types, `JsBox`
@@ -141,15 +141,15 @@ mod private {
141141/// Ok(cx.string(greeting))
142142/// }
143143#[ repr( transparent) ]
144- pub struct JsBox < T : Send + ' static > ( JsBoxInner < T > ) ;
144+ pub struct JsBox < T : ' static > ( JsBoxInner < T > ) ;
145145
146- impl < T : Send + ' static > std:: fmt:: Debug for JsBoxInner < T > {
146+ impl < T : ' static > std:: fmt:: Debug for JsBoxInner < T > {
147147 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
148148 write ! ( f, "JsBox<{}>" , std:: any:: type_name:: <T >( ) )
149149 }
150150}
151151
152- impl < T : Send + ' static > std:: fmt:: Debug for JsBox < T > {
152+ impl < T : ' static > std:: fmt:: Debug for JsBox < T > {
153153 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
154154 std:: fmt:: Debug :: fmt ( & self . 0 , f)
155155 }
@@ -162,7 +162,7 @@ unsafe fn maybe_external_deref<'a>(env: Env, local: raw::Local) -> Option<&'a Bo
162162}
163163
164164// Custom `Clone` implementation since `T` might not be `Clone`
165- impl < T : Send + ' static > Clone for JsBoxInner < T > {
165+ impl < T : ' static > Clone for JsBoxInner < T > {
166166 fn clone ( & self ) -> Self {
167167 Self {
168168 local : self . local ,
@@ -171,21 +171,21 @@ impl<T: Send + 'static> Clone for JsBoxInner<T> {
171171 }
172172}
173173
174- impl < T : Send + ' static > Object for JsBox < T > { }
174+ impl < T : ' static > Object for JsBox < T > { }
175175
176- impl < T : Send + ' static > Copy for JsBoxInner < T > { }
176+ impl < T : ' static > Copy for JsBoxInner < T > { }
177177
178- impl < T : Send + ' static > Value for JsBox < T > { }
178+ impl < T : ' static > Value for JsBox < T > { }
179179
180- unsafe impl < T : Send + ' static > TransparentNoCopyWrapper for JsBox < T > {
180+ unsafe impl < T : ' static > TransparentNoCopyWrapper for JsBox < T > {
181181 type Inner = JsBoxInner < T > ;
182182
183183 fn into_inner ( self ) -> Self :: Inner {
184184 self . 0
185185 }
186186}
187187
188- impl < T : Send + ' static > ValueInternal for JsBox < T > {
188+ impl < T : ' static > ValueInternal for JsBox < T > {
189189 fn name ( ) -> String {
190190 any:: type_name :: < Self > ( ) . to_string ( )
191191 }
@@ -219,30 +219,25 @@ impl<T: Send + 'static> ValueInternal for JsBox<T> {
219219 }
220220}
221221
222- /// Values contained by a `JsBox` must be `Finalize + Send + 'static`
222+ /// Values contained by a `JsBox` must be `Finalize + 'static`
223223///
224224/// ### `Finalize`
225225///
226226/// The `sys::prelude::Finalize` trait provides a `finalize` method that will be called
227227/// immediately before the `JsBox` is garbage collected.
228228///
229- /// ### `Send`
230- ///
231- /// `JsBox` may be moved across threads. It is important to guarantee that the
232- /// contents is also safe to move across threads.
233- ///
234229/// ### `'static'
235230///
236231/// The lifetime of a `JsBox` is managed by the JavaScript garbage collector. Since Rust
237232/// is unable to verify the lifetime of the contents, references must be valid for the
238233/// entire duration of the program. This does not mean that the `JsBox` will be valid
239234/// until the application terminates, only that its lifetime is indefinite.
240- impl < T : Finalize + Send + ' static > JsBox < T > {
235+ impl < T : Finalize + ' static > JsBox < T > {
241236 /// Constructs a new `JsBox` containing `value`.
242237 pub fn new < ' a , C > ( cx : & mut C , value : T ) -> Handle < ' a , JsBox < T > >
243238 where
244239 C : Context < ' a > ,
245- T : Send + ' static ,
240+ T : ' static ,
246241 {
247242 // This function will execute immediately before the `JsBox` is garbage collected.
248243 // It unwraps the `napi_external`, downcasts the `BoxAny` and moves the type
@@ -264,7 +259,7 @@ impl<T: Finalize + Send + 'static> JsBox<T> {
264259 }
265260}
266261
267- impl < T : Send + ' static > Deref for JsBox < T > {
262+ impl < T : ' static > Deref for JsBox < T > {
268263 type Target = T ;
269264
270265 fn deref ( & self ) -> & Self :: Target {
0 commit comments