From ad44c70e918c695298c2480a8b3df5be60c3e95d Mon Sep 17 00:00:00 2001 From: Mica White Date: Sat, 31 Oct 2026 12:37:29 -0400 Subject: Require Serialize in AOT --- platforms/tortuise-script-compiled/src/entity.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'platforms/tortuise-script-compiled/src/entity.rs') diff --git a/platforms/tortuise-script-compiled/src/entity.rs b/platforms/tortuise-script-compiled/src/entity.rs index fe60ae2..01739e3 100644 --- a/platforms/tortuise-script-compiled/src/entity.rs +++ b/platforms/tortuise-script-compiled/src/entity.rs @@ -1,5 +1,6 @@ use core::ops::{Deref, DerefMut}; +use serde::{Serialize, de::DeserializeOwned}; use spin::lock_api::{MappedRwLockWriteGuard, RwLock, RwLockWriteGuard}; use crate::ScriptContext; @@ -33,7 +34,10 @@ impl Entity { } } - pub fn get(&self, context: &ScriptContext) -> EntityRef<'_, T> { + pub fn get(&self, context: &ScriptContext) -> EntityRef<'_, T> + where + T: DeserializeOwned, + { #[cfg(feature = "profiling")] puffin::profile_function!(); let data = RwLockWriteGuard::map(self.data.write(), |data| { @@ -42,7 +46,10 @@ impl Entity { EntityRef { data } } - pub fn get_mut(&self, context: &ScriptContext) -> EntityMut<'_, T> { + pub fn get_mut(&self, context: &ScriptContext) -> EntityMut<'_, T> + where + T: DeserializeOwned + Serialize, + { #[cfg(feature = "profiling")] puffin::profile_function!(); let data = RwLockWriteGuard::map(self.data.write(), |data| { -- cgit v1.3.1