get rid of warnings
This commit is contained in:
parent
9db84f0360
commit
d02b6375c6
4 changed files with 29 additions and 35 deletions
|
|
@ -260,14 +260,14 @@ impl Runtime for LuaRuntime {
|
|||
|
||||
fn with_engine_thread_mut<T: Send + 'static>(
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self::RawEngine) -> T + Send + 'static,
|
||||
_f: impl FnOnce(&mut Self::RawEngine) -> T + Send + 'static,
|
||||
) -> T {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn with_engine_thread<T: Send + 'static>(
|
||||
&self,
|
||||
f: impl FnOnce(&Self::RawEngine) -> T + Send + 'static,
|
||||
_f: impl FnOnce(&Self::RawEngine) -> T + Send + 'static,
|
||||
) -> T {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,14 +163,14 @@ impl Runtime for RhaiRuntime {
|
|||
|
||||
fn with_engine_thread_mut<T: Send + 'static>(
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self::RawEngine) -> T + Send + 'static,
|
||||
_f: impl FnOnce(&mut Self::RawEngine) -> T + Send + 'static,
|
||||
) -> T {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn with_engine_thread<T: Send + 'static>(
|
||||
&self,
|
||||
f: impl FnOnce(&Self::RawEngine) -> T + Send + 'static,
|
||||
_f: impl FnOnce(&Self::RawEngine) -> T + Send + 'static,
|
||||
) -> T {
|
||||
todo!()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// TODO: make sure ruby is statically linked
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, Condvar, LazyLock, Mutex, MutexGuard},
|
||||
sync::{Arc, Condvar, LazyLock, Mutex},
|
||||
thread::{self, JoinHandle},
|
||||
};
|
||||
|
||||
|
|
@ -12,13 +12,12 @@ use bevy::{
|
|||
reflect::TypePath,
|
||||
};
|
||||
use magnus::Ruby;
|
||||
use magnus::{embed::Cleanup, function, prelude::*};
|
||||
use magnus::{function, prelude::*};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{
|
||||
assets::GetExtensions,
|
||||
callback::{FromRuntimeValueWithEngine, IntoRuntimeValueWithEngine},
|
||||
runtimes::ruby,
|
||||
FuncArgs, Runtime,
|
||||
};
|
||||
|
||||
|
|
@ -47,10 +46,11 @@ impl From<String> for RubyScript {
|
|||
Self(value)
|
||||
}
|
||||
}
|
||||
struct RubyEngine(Cleanup);
|
||||
|
||||
type RubyClosure = Box<dyn FnOnce(Ruby) + Send>;
|
||||
|
||||
struct RubyThread {
|
||||
sender: Option<crossbeam_channel::Sender<Box<dyn FnOnce(Ruby) + Send>>>,
|
||||
sender: Option<crossbeam_channel::Sender<RubyClosure>>,
|
||||
handle: Option<JoinHandle<()>>,
|
||||
}
|
||||
|
||||
|
|
@ -157,11 +157,11 @@ impl Runtime for RubyRuntime {
|
|||
.execute(Box::new(move |ruby| f(&ruby)))
|
||||
}
|
||||
|
||||
fn with_engine_mut<T>(&mut self, f: impl FnOnce(&mut Self::RawEngine) -> T) -> T {
|
||||
fn with_engine_mut<T>(&mut self, _f: impl FnOnce(&mut Self::RawEngine) -> T) -> T {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn with_engine<T>(&self, f: impl FnOnce(&Self::RawEngine) -> T) -> T {
|
||||
fn with_engine<T>(&self, _f: impl FnOnce(&Self::RawEngine) -> T) -> T {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
|
|
@ -195,24 +195,18 @@ impl Runtime for RubyRuntime {
|
|||
+ Sync
|
||||
+ 'static,
|
||||
) -> Result<(), crate::ScriptingError> {
|
||||
static RUBY_CALLBACKS: LazyLock<
|
||||
Mutex<
|
||||
HashMap<
|
||||
String,
|
||||
Box<
|
||||
dyn Fn(
|
||||
(),
|
||||
Vec<RubyValue>,
|
||||
) -> Result<
|
||||
crate::promise::Promise<(), RubyValue>,
|
||||
crate::ScriptingError,
|
||||
> + Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
>,
|
||||
>,
|
||||
>,
|
||||
> = LazyLock::new(|| Mutex::new(HashMap::new()));
|
||||
type CallbackClosure = Box<
|
||||
dyn Fn(
|
||||
(),
|
||||
Vec<RubyValue>,
|
||||
)
|
||||
-> Result<crate::promise::Promise<(), RubyValue>, crate::ScriptingError>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
>;
|
||||
static RUBY_CALLBACKS: LazyLock<Mutex<HashMap<String, CallbackClosure>>> =
|
||||
LazyLock::new(|| Mutex::new(HashMap::new()));
|
||||
let mut callbacks = RUBY_CALLBACKS.lock().unwrap();
|
||||
callbacks.insert(name.clone(), Box::new(f));
|
||||
|
||||
|
|
@ -223,7 +217,7 @@ impl Runtime for RubyRuntime {
|
|||
let method_name = method_name.to_string();
|
||||
let callbacks = RUBY_CALLBACKS.lock().unwrap();
|
||||
let f = callbacks.get(&method_name).unwrap();
|
||||
f((), vec![]);
|
||||
f((), vec![]).unwrap();
|
||||
ruby.qnil().as_value()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ mod lua_tests {
|
|||
mod ruby_tests {
|
||||
use bevy::prelude::*;
|
||||
use bevy_scriptum::runtimes::ruby::{prelude::*, RubyScriptData};
|
||||
use magnus::{value::ReprValue, Module, Object, Ruby};
|
||||
use magnus::{value::ReprValue, Module};
|
||||
|
||||
impl AssertStateKeyValue for RubyRuntime {
|
||||
type ScriptData = RubyScriptData;
|
||||
|
|
@ -502,15 +502,15 @@ mod ruby_tests {
|
|||
})
|
||||
}
|
||||
|
||||
fn assert_state_key_value_i32(world: &World, _entity_id: Entity, key: &str, value: i32) {
|
||||
fn assert_state_key_value_i32(_world: &World, _entity_id: Entity, _key: &str, _value: i32) {
|
||||
todo!();
|
||||
}
|
||||
|
||||
fn assert_state_key_value_string(
|
||||
world: &World,
|
||||
_world: &World,
|
||||
_entity_id: Entity,
|
||||
key: &str,
|
||||
value: &str,
|
||||
_key: &str,
|
||||
_value: &str,
|
||||
) {
|
||||
todo!();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue