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