Open psarna opened 1 year ago
@psarna I claim the issue. I was waiting for someone to do so, but since no one yet, this issue interests me.
Thanks for volunteering! If you need any guidance, feel free to ask
@psarna Does this looks like something good to start? P.s. i am super new to Rust.
pub fn libsql_wasm_engine_new<Struct>(configs: Option<Struct>) -> *const c_void {
let engine = match Engine::new(&Config::new()) {
Ok(eng) => eng,
Err(_) => return std::ptr::null() as *const c_void,
};
}
Also, in the docs i can only see methods. Where are we passing the option params next?
Right now the WebAssembly runtime is initialized with default settings only: https://github.com/libsql/libsql/blob/bd68c17adf23c038fcfc44813ea2a943b423ca63/src/rust/wasmtime-bindings/src/lib.rs#L80-L90
It would be nice to have a way of modifying the defaults, e.g. the WebAssembly stack size, various time limits, profiling, preemptions, etc. Here's how Wasmtime can be configured: https://docs.wasmtime.dev/api/wasmtime/struct.Config.html
libsql_wasm_engine_new
function does not take parameters now, but we could extend it with a configuration struct, that can be used to pass custom options, e.g. passed as preprocessor macros or a custom PRAGMA statement.