style(napi): as ptr => ptr::cast (#1786)

This commit is contained in:
LongYinan 2023-11-06 11:22:30 +08:00 committed by GitHub
parent 1e5c32ca60
commit 65f57918fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,11 +155,11 @@ impl Env {
}
pub fn create_string(&self, s: &str) -> Result<JsString> {
unsafe { self.create_string_from_c_char(s.as_ptr() as *const c_char, s.len()) }
unsafe { self.create_string_from_c_char(s.as_ptr().cast(), s.len()) }
}
pub fn create_string_from_std(&self, s: String) -> Result<JsString> {
unsafe { self.create_string_from_c_char(s.as_ptr() as *const c_char, s.len()) }
unsafe { self.create_string_from_c_char(s.as_ptr().cast(), s.len()) }
}
/// This API is used for C ffi scenario.