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/state.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'platforms/tortuise-script-compiled/src/state.rs') diff --git a/platforms/tortuise-script-compiled/src/state.rs b/platforms/tortuise-script-compiled/src/state.rs index 9e20cf7..77a8335 100644 --- a/platforms/tortuise-script-compiled/src/state.rs +++ b/platforms/tortuise-script-compiled/src/state.rs @@ -1,5 +1,6 @@ use core::ops::{Deref, DerefMut}; +use serde::{Serialize, de::DeserializeOwned}; use spin::lock_api::{MappedMutexGuard, Mutex, MutexGuard}; use crate::ScriptContext; @@ -25,7 +26,10 @@ impl ScriptState { } } - pub fn get(&self, context: &ScriptContext) -> StateRef<'_, T> { + pub fn get(&self, context: &ScriptContext) -> StateRef<'_, T> + where + T: DeserializeOwned, + { #[cfg(feature = "profiling")] puffin::profile_function!(); let data = MutexGuard::map(self.data.lock(), |data| { @@ -34,7 +38,10 @@ impl ScriptState { StateRef { data } } - pub fn get_mut(&self, context: &ScriptContext) -> StateMut<'_, T> { + pub fn get_mut(&self, context: &ScriptContext) -> StateMut<'_, T> + where + T: Serialize + DeserializeOwned, + { #[cfg(feature = "profiling")] puffin::profile_function!(); let data = MutexGuard::map(self.data.lock(), |data| { -- cgit v1.3.1