From 7eb4a346b850e98f09468cbbae19b73c0f3a659c Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Wed, 14 May 2025 14:06:42 +0200 Subject: [PATCH] add todo --- ...unction_gets_called_from_script_with_multiple_params.rb | 3 +++ ...ipt_function_gets_called_from_rust_with_single_param.rb | 7 +++++++ src/runtimes/ruby.rs | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 assets/tests/ruby/rust_function_gets_called_from_script_with_multiple_params.rb create mode 100644 assets/tests/ruby/script_function_gets_called_from_rust_with_single_param.rb diff --git a/assets/tests/ruby/rust_function_gets_called_from_script_with_multiple_params.rb b/assets/tests/ruby/rust_function_gets_called_from_script_with_multiple_params.rb new file mode 100644 index 0000000..026ad0b --- /dev/null +++ b/assets/tests/ruby/rust_function_gets_called_from_script_with_multiple_params.rb @@ -0,0 +1,3 @@ +def test_func + rust_func(5, "test") +end diff --git a/assets/tests/ruby/script_function_gets_called_from_rust_with_single_param.rb b/assets/tests/ruby/script_function_gets_called_from_rust_with_single_param.rb new file mode 100644 index 0000000..a71146d --- /dev/null +++ b/assets/tests/ruby/script_function_gets_called_from_rust_with_single_param.rb @@ -0,0 +1,7 @@ +STATE = { + "a_value" => nil +} + +def test_func(a) + STATE["a_value"] = a +end diff --git a/src/runtimes/ruby.rs b/src/runtimes/ruby.rs index b351463..f245579 100644 --- a/src/runtimes/ruby.rs +++ b/src/runtimes/ruby.rs @@ -4,6 +4,8 @@ // TODO: consider dropping magnus // TODO: unwinding https://doc.rust-lang.org/nomicon/ffi.html#variadic-functions // TODO: maybe unify api and call non thread methods non_send +// TODO: use ruby arena to rewind state + use std::{ collections::HashMap, ffi::{c_void, CString},