Rust bindings for Sciter
Check this page for other language bindings (Delphi / D / Go / .NET / Python / Rust).
Sciter is an embeddable multiplatform HTML/CSS/script engine with GPU accelerated rendering designed to render modern desktop application UI. It's a compact, single dll/dylib/so file (4-8 mb) engine without any additional dependencies.
Check the screenshot gallery of desktop UI examples and DirectX UI integration via Rust GFX.
Physically Sciter is a mono library which contains:
Internally it contains the following modules:
<input>
, <select>
, <textarea>
, etc.Sciter supports all standard elements defined in HTML5 specification with some additions. CSS is extended to better support the Desktop UI development, e.g. flow and flex units, vertical and horizontal alignment, OS theming.
Sciter SDK comes with a demo "browser" with a builtin DOM inspector, script debugger and documentation viewer:
Check https://sciter.com website and its documentation resources for engine principles, architecture and more.
bin.win
, bin.osx
or bin.lnx
).cargo run --example minimal
.sciter-rs = "*"
.Here is a minimal sciter app:
extern crate sciter;
fn main() {
let mut frame = sciter::Window::new();
frame.load_file("minimal.htm");
frame.run_app();
}
It looks similar to this:
In respect of tiscript or JavaScript functions calling:
use sciter::{Element, Value};
let root = Element::from_window(hwnd);
let result: Value = root.call_function("namespace.name", &make_args!(1,"2",3));
Calling Rust from script can be implemented as following:
struct Handler;
impl Handler {
fn calc_sum(&self, a: i32, b: i32) -> i32 {
a + b
}
}
impl sciter::EventHandler for Handler {
dispatch_script_call! {
fn calc_sum(i32, i32);
}
}
And we can access this function from TIScript:
// `view` represents the window where this script is running.
// `stdout` stream is a standard output stream (shell or debugger console, for example)
stdout.printf("2 + 3 = %d\n", view.calc_sum(2, 3));
or from JavaScript:
// `Window.this` represents the window where this script is running.
console.log("2 + 3", Window.this.xcall("calc_sum", 2, 3));
Check rust-sciter/examples folder for more complex usage.
sdk/bin/packfolder
tool.Bindings library licensed under MIT license. Sciter Engine has the own license terms and end used license agreement for SDK usage.