migration to JS engine #1

Merged
akulij merged 131 commits from dev into main 2025-05-31 08:49:52 +00:00
Showing only changes of commit eb63743714 - Show all commits

View File

@ -27,6 +27,19 @@ impl BotFunction {
runner.run_script(&format!("{func_name}()"))
}
}
pub trait DeserializeJS {
fn js_into<'a, T: Deserialize<'a>>(&'a self) -> ScriptResult<T>;
}
impl DeserializeJS for JsValue {
fn js_into<'a, T: Deserialize<'a>>(&'a self) -> ScriptResult<T> {
let rc = from_js(self.context(), &self)?;
Ok(rc)
}
}
// TODO: remove this function since it is suitable only for early development
#[allow(clippy::print_stdout)]
fn print(s: String) {