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 | |
| parent | a802a6c638b5b8dc3ca4c2b76a090988d3e6d557 (diff) | |
Require Serialize in AOT
Diffstat (limited to 'platforms/tortuise-script-compiled/src')
| -rw-r--r-- | platforms/tortuise-script-compiled/src/entity.rs | 11 | ||||
| -rw-r--r-- | platforms/tortuise-script-compiled/src/state.rs | 11 |
2 files changed, 18 insertions, 4 deletions
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<T> Entity<T> { } } - 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<T> Entity<T> { 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| { 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| { |
