diff --git a/src/high/squirrel_traits.rs b/src/high/squirrel_traits.rs index ee65944..d761544 100644 --- a/src/high/squirrel_traits.rs +++ b/src/high/squirrel_traits.rs @@ -285,6 +285,8 @@ pub trait GetFromSquirrelVm: Sized { /// this is only for certain internal apis /// /// don't use this only for internal apis + #[doc(hidden)] + #[inline] fn get_from_sqvm_internal( sqvm: NonNull, sqfunctions: &'static SquirrelFunctions, @@ -474,6 +476,29 @@ impl GetFromSQObject for Vector3 { } } +impl GetFromSQObject for SQObject { + #[inline] + fn get_from_sqobject(obj: &SQObject) -> Self { + *obj + } +} + +impl GetFromSQObject for SQHandle { + #[inline] + fn get_from_sqobject(obj: &SQObject) -> Self { + match Self::try_new(*obj) { + Ok(handle) => handle, + Err(_) => { + panic!( + "the object wasn't the correct type got {:X} expected {}", + obj._Type as i32, + std::any::type_name::() + ); + } + } + } +} + impl GetFromSQObject for SquirrelFn { #[inline] fn get_from_sqobject(obj: &SQObject) -> Self { diff --git a/src/mid/source_alloc.rs b/src/mid/source_alloc.rs index f6fcf61..466666f 100644 --- a/src/mid/source_alloc.rs +++ b/src/mid/source_alloc.rs @@ -48,7 +48,7 @@ impl SourceAlloc { /// /// the source allocator has more functions which may be useful pub fn get_underlying_alloc(&self) -> &'static IMemAlloc { - self.0.wait().get() + unsafe { self.0.get_unchecked().get() } // should be init } }