From 9f98a443af798f033870d680a9c5fb4bbd9d3621 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Mon, 22 Apr 2024 17:25:46 -0400 Subject: [PATCH] . --- src/fast_api.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/fast_api.rs b/src/fast_api.rs index 7e9e52df0..7b8de7b41 100644 --- a/src/fast_api.rs +++ b/src/fast_api.rs @@ -1,11 +1,8 @@ use crate::support::Opaque; use crate::Local; +use crate::UniqueRef; use crate::Value; -use std::{ - ffi::c_void, - mem::align_of, - ptr::{self, NonNull}, -}; +use std::{ffi::c_void, mem::align_of, ptr}; extern "C" { fn v8__CTypeInfo__New(ty: CType) -> *mut CTypeInfo; @@ -38,8 +35,8 @@ impl CFunctionInfo { args_len: usize, return_type: *const CTypeInfo, repr: Int64Representation, - ) -> NonNull { - NonNull::new_unchecked(v8__CFunctionInfo__New( + ) -> UniqueRef { + UniqueRef::from_raw(v8__CFunctionInfo__New( return_type, args_len, args, @@ -60,11 +57,11 @@ pub struct CTypeInfo(Opaque); impl CTypeInfo { #[inline(always)] - pub fn new(ty: CType) -> NonNull { - unsafe { NonNull::new_unchecked(v8__CTypeInfo__New(ty)) } + pub fn new(ty: CType) -> UniqueRef { + unsafe { UniqueRef::from_raw(v8__CTypeInfo__New(ty)) } } - pub fn new_from_slice(types: &[Type]) -> NonNull { + pub fn new_from_slice(types: &[Type]) -> UniqueRef { let mut structs = vec![]; for type_ in types.iter() { @@ -72,7 +69,7 @@ impl CTypeInfo { } unsafe { - NonNull::new_unchecked(v8__CTypeInfo__New__From__Slice( + UniqueRef::from_raw(v8__CTypeInfo__New__From__Slice( structs.len(), structs.as_ptr(), ))