mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 06:38:22 +00:00
chore: Remove unused function
This commit is contained in:
@@ -257,30 +257,6 @@ impl std::error::Error for RuntimeError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generic_of_jsval<T: FromWasmAbi<Abi = u32>>(
|
|
||||||
js: JsValue,
|
|
||||||
classname: &str,
|
|
||||||
) -> Result<T, JsValue> {
|
|
||||||
use js_sys::{Object, Reflect};
|
|
||||||
let ctor_name = Object::get_prototype_of(&js).constructor().name();
|
|
||||||
if ctor_name == classname {
|
|
||||||
#[allow(unused_unsafe)]
|
|
||||||
let ptr = unsafe { Reflect::get(&js, &JsValue::from_str("ptr"))? };
|
|
||||||
match ptr.as_f64() {
|
|
||||||
Some(ptr_f64) => {
|
|
||||||
let foo = unsafe { T::from_abi(ptr_f64 as u32) };
|
|
||||||
Ok(foo)
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
// We simply relay the js value
|
|
||||||
Err(js)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Err(js)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<JsValue> for RuntimeError {
|
impl From<JsValue> for RuntimeError {
|
||||||
fn from(original: JsValue) -> Self {
|
fn from(original: JsValue) -> Self {
|
||||||
// We try to downcast the error and see if it's
|
// We try to downcast the error and see if it's
|
||||||
|
|||||||
Reference in New Issue
Block a user