From 12503a80615072cf3928bb49c31d97a797a2eb02 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 25 Jan 2024 23:29:56 +0800 Subject: [PATCH] chore(napi): delete unwrap_from_ref API because it was never work --- crates/napi/src/env.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/crates/napi/src/env.rs b/crates/napi/src/env.rs index ff50b599..4b0a32af 100644 --- a/crates/napi/src/env.rs +++ b/crates/napi/src/env.rs @@ -794,36 +794,6 @@ impl Env { } } - pub fn unwrap_from_ref(&self, js_ref: &Ref<()>) -> Result<&'static mut T> { - unsafe { - let mut unknown_tagged_object: *mut c_void = ptr::null_mut(); - check_status!(sys::napi_unwrap( - self.0, - js_ref.raw_value, - &mut unknown_tagged_object, - ))?; - - let type_id = unknown_tagged_object as *const TypeId; - if *type_id == TypeId::of::() { - let tagged_object = unknown_tagged_object as *mut TaggedObject; - (*tagged_object).object.as_mut().ok_or_else(|| { - Error::new( - Status::InvalidArg, - "Invalid argument, nothing attach to js_object".to_owned(), - ) - }) - } else { - Err(Error::new( - Status::InvalidArg, - format!( - "Invalid argument, {} on unwrap is not the type of wrapped object", - type_name::() - ), - )) - } - } - } - pub fn drop_wrapped(&self, js_object: &JsObject) -> Result<()> { unsafe { let mut unknown_tagged_object = ptr::null_mut();