@@ -1953,18 +1953,18 @@ impl From<JsError> for JsValue {
1953
1953
macro_rules! typed_arrays {
1954
1954
( $( $ty: ident $ctor: ident $clamped_ctor: ident, ) * ) => {
1955
1955
$(
1956
- impl From <Vec < $ty>> for JsValue {
1957
- fn from( mut vec : Vec < $ty>) -> Self {
1958
- let result = unsafe { JsValue :: _new( $ctor( vec . as_mut_ptr( ) , vec . len( ) ) ) } ;
1959
- mem:: forget( vec ) ;
1956
+ impl From <Box < [ $ty] >> for JsValue {
1957
+ fn from( mut vector : Box < [ $ty] >) -> Self {
1958
+ let result = unsafe { JsValue :: _new( $ctor( vector . as_mut_ptr( ) , vector . len( ) ) ) } ;
1959
+ mem:: forget( vector ) ;
1960
1960
result
1961
1961
}
1962
1962
}
1963
1963
1964
- impl From <Clamped <Vec < $ty>>> for JsValue {
1965
- fn from( mut vec : Clamped <Vec < $ty>>) -> Self {
1966
- let result = unsafe { JsValue :: _new( $clamped_ctor( vec . as_mut_ptr( ) , vec . len( ) ) ) } ;
1967
- mem:: forget( vec ) ;
1964
+ impl From <Clamped <Box < [ $ty] >>> for JsValue {
1965
+ fn from( mut vector : Clamped <Box < [ $ty] >>) -> Self {
1966
+ let result = unsafe { JsValue :: _new( $clamped_ctor( vector . as_mut_ptr( ) , vector . len( ) ) ) } ;
1967
+ mem:: forget( vector ) ;
1968
1968
result
1969
1969
}
1970
1970
}
@@ -2011,3 +2011,12 @@ where
2011
2011
JsValue :: from ( vector. into_boxed_slice ( ) )
2012
2012
}
2013
2013
}
2014
+
2015
+ impl < T > From < Clamped < Vec < T > > > for JsValue
2016
+ where
2017
+ JsValue : From < Clamped < Box < [ T ] > > > ,
2018
+ {
2019
+ fn from ( vector : Clamped < Vec < T > > ) -> Self {
2020
+ JsValue :: from ( Clamped ( vector. 0 . into_boxed_slice ( ) ) )
2021
+ }
2022
+ }
0 commit comments