diff options
| author | Mica White <botahamec@outlook.com> | 2026-10-31 12:37:29 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-10-31 12:37:29 -0400 |
| commit | ad44c70e918c695298c2480a8b3df5be60c3e95d (patch) | |
| tree | 49e568461de666984a22c1eba9bfb116e3e5bb29 /platforms/tortuise-script-compiled/src/state.rs | |
| parent | a802a6c638b5b8dc3ca4c2b76a090988d3e6d557 (diff) | |
Require Serialize in AOT
Diffstat (limited to 'platforms/tortuise-script-compiled/src/state.rs')
| -rw-r--r-- | platforms/tortuise-script-compiled/src/state.rs | 11 |
1 files changed, 9 insertions, 2 deletions
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<T> ScriptState<T> { } } - 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<T> ScriptState<T> { 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| { |
