diff options
| author | Mica White <botahamec@outlook.com> | 2026-10-26 10:52:04 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2026-10-26 10:58:46 -0400 |
| commit | ec40f6e3acc7874b82709ab81b254c741529fdff (patch) | |
| tree | e3dfdc315bd0c6f1d2efcf442c2cfb3317d6810f /src/script.rs | |
| parent | e3c5839159903658a667f789963f20a31567b25c (diff) | |
Diffstat (limited to 'src/script.rs')
| -rw-r--r-- | src/script.rs | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/script.rs b/src/script.rs deleted file mode 100644 index 0de2b54..0000000 --- a/src/script.rs +++ /dev/null @@ -1,44 +0,0 @@ -use crate::ScriptContext; - -mod tortuise { - #[link(wasm_import_module = "tortuise")] - unsafe extern "C" { - pub unsafe fn script_id_by_name(context: u64, name: *const u8, length: usize) -> usize; - pub safe fn preload_script(context: u64, id: usize); - pub safe fn is_script_loaded(context: u64, id: usize) -> u32; - pub safe fn unload_script(context: u64, id: usize); - pub safe fn activate_script(context: u64, id: usize); - pub safe fn deactivate_script(context: u64, id: usize); - } -} - -impl ScriptContext { - pub fn script_id(&self, name: &str) -> usize { - unsafe { tortuise::script_id_by_name(self.0, name.as_ptr(), name.len()) } - } - - pub fn preload_script(&self, name: &str) { - let id = self.script_id(name); - tortuise::preload_script(self.0, id) - } - - pub fn is_script_loaded(&self, name: &str) -> bool { - let id = self.script_id(name); - tortuise::is_script_loaded(self.0, id) > 0 - } - - pub fn unload_script(&self, name: &str) { - let id = self.script_id(name); - tortuise::unload_script(self.0, id) - } - - pub fn activate_script(&self, name: &str) { - let id = self.script_id(name); - tortuise::activate_script(self.0, id) - } - - pub fn deactivate_script(&self, name: &str) { - let id = self.script_id(name); - tortuise::deactivate_script(self.0, id) - } -} |
