Skip to content

Commit 01f92e4

Browse files
committed
Remove JsFunction type parameter
1 parent 69e70ef commit 01f92e4

File tree

1 file changed

+7
-12
lines changed
  • crates/neon/src/types_impl

1 file changed

+7
-12
lines changed

crates/neon/src/types_impl/mod.rs

+7-12
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub(crate) mod utf8;
1616

1717
use std::{
1818
fmt::{self, Debug},
19-
marker::PhantomData,
2019
os::raw::c_void,
2120
};
2221

@@ -1040,12 +1039,11 @@ impl Object for JsArray {}
10401039
/// # Ok(f)
10411040
/// # }
10421041
/// ```
1043-
pub struct JsFunction<T: Object = JsObject> {
1042+
pub struct JsFunction {
10441043
raw: raw::Local,
1045-
marker: PhantomData<T>,
10461044
}
10471045

1048-
impl<T: Object> Object for JsFunction<T> {}
1046+
impl Object for JsFunction {}
10491047

10501048
// Maximum number of function arguments in V8.
10511049
const V8_ARGC_LIMIT: usize = 65535;
@@ -1123,7 +1121,6 @@ impl JsFunction {
11231121
if let Ok(raw) = sys::fun::new(cx.env().to_raw(), name, f) {
11241122
Ok(Handle::new_internal(JsFunction {
11251123
raw,
1126-
marker: PhantomData,
11271124
}))
11281125
} else {
11291126
Err(Throw::new())
@@ -1132,7 +1129,7 @@ impl JsFunction {
11321129
}
11331130
}
11341131

1135-
impl<CL: Object> JsFunction<CL> {
1132+
impl JsFunction {
11361133
/// Calls this function.
11371134
///
11381135
/// **See also:** [`JsFunction::call_with`].
@@ -1173,7 +1170,7 @@ impl<CL: Object> JsFunction<CL> {
11731170
/// Calls this function as a constructor.
11741171
///
11751172
/// **See also:** [`JsFunction::construct_with`].
1176-
pub fn construct<'a, 'b, C: Context<'a>, AS>(&self, cx: &mut C, args: AS) -> JsResult<'a, CL>
1173+
pub fn construct<'a, 'b, C: Context<'a>, AS>(&self, cx: &mut C, args: AS) -> JsResult<'a, JsObject>
11771174
where
11781175
AS: AsRef<[Handle<'b, JsValue>]>,
11791176
{
@@ -1216,23 +1213,22 @@ impl JsFunction {
12161213
/// The caller must wrap in a `Handle` with an appropriate lifetime.
12171214
unsafe fn clone(&self) -> Self {
12181215
Self {
1219-
marker: PhantomData,
12201216
raw: self.raw,
12211217
}
12221218
}
12231219
}
12241220

1225-
impl<T: Object> Value for JsFunction<T> {}
1221+
impl Value for JsFunction {}
12261222

1227-
unsafe impl<T: Object> TransparentNoCopyWrapper for JsFunction<T> {
1223+
unsafe impl TransparentNoCopyWrapper for JsFunction {
12281224
type Inner = raw::Local;
12291225

12301226
fn into_inner(self) -> Self::Inner {
12311227
self.raw
12321228
}
12331229
}
12341230

1235-
impl<T: Object> ValueInternal for JsFunction<T> {
1231+
impl ValueInternal for JsFunction {
12361232
fn name() -> String {
12371233
"function".to_string()
12381234
}
@@ -1248,7 +1244,6 @@ impl<T: Object> ValueInternal for JsFunction<T> {
12481244
unsafe fn from_local(_env: Env, h: raw::Local) -> Self {
12491245
JsFunction {
12501246
raw: h,
1251-
marker: PhantomData,
12521247
}
12531248
}
12541249
}

0 commit comments

Comments
 (0)