From b1c8192d2a6de6334fb3c3c4677a00f816ba727c Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 25 Dec 2020 12:02:24 +0800 Subject: [PATCH] refactor(napi): JsUnknow::cast now will not move ownership --- napi/src/js_values/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/napi/src/js_values/mod.rs b/napi/src/js_values/mod.rs index c2eb7d63..ad700ba0 100644 --- a/napi/src/js_values/mod.rs +++ b/napi/src/js_values/mod.rs @@ -610,9 +610,11 @@ impl JsUnknown { #[inline] /// # Safety + /// /// This function should be called after `JsUnknown::get_type` + /// /// And the `V` must be match with the return value of `get_type` - pub unsafe fn cast(self) -> V + pub unsafe fn cast(&self) -> V where V: NapiValue, {