Rust bindings for Sciter

Build status Build Status Current Version Documentation License Join the forums at https://sciter.com/forums

Check this page for other language bindings (Delphi / D / Go / .NET / Python / Rust).


Introduction

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.

Screenshots

Check screenshot gallery of the desktop UI examples and DirectX UI integration via Rust GFX.

Description

Physically Sciter is a mono library which contains:

Internally it contains the following modules:

Sciter supports all standard elements defined in HTML5 specification with some additions. CSS extended to better support Desktop UI development, e.g. flow and flex units, vertical and horizontal alignment, OS theming.

Sciter SDK comes with demo "browser" with builtin DOM inspector, script debugger and documentation browser:

Sciter tools

Check https://sciter.com website and its documentation resources for engine principles, architecture and more.

Getting started:

  1. Download Sciter SDK and extract it somewhere.
  2. Add target platform binaries to PATH (bin, bin.osx or bin.gtk) and install Sciter shared library to your LIBRARY_PATH (the latter is not required if you build crate with --features "dynamic" enabled).
  3. If you do not already have it installed, you need GTK 3 development tools installed to continue: sudo apt-get install libgtk-3-dev
  4. Build library and run the minimal sciter sample: cargo run --example minimal.
  5. For your apps add the following dependency to the Cargo.toml: sciter-rs = "*".

Brief look:

Here is a minimal sciter app:

```rust extern crate sciter;

fn main() { let mut frame = sciter::Window::new(); frame.loadfile("minimal.htm"); frame.runapp(); } ```

It looks similar to this:

Minimal sciter sample

Interoperability

In respect of tiscript functions calling: ```rust use sciter::{Element, Value};

let root = Element::fromwindow(hwnd); let result: Value = root.callfunction("namespace.name", &make_args!(1,"2",3)); ```

Calling rust from script can be implemented as following: ```rust struct Handler;

impl Handler { fn calc_sum(&self, a: i32, b: i32) -> i32 { a + b } }

impl sciter::EventHandler for Handler { dispatchscriptcall! { fn calc_sum(i32, i32); } } ```

And we can access this function from script: ``js //viewrepresents window where script is runnung. //stdout` stream is a standard output stream (shell or debugger console, for example)

stdout.printf("2 + 3 = %d\n", view.calc_sum(2, 3)); ```

Check rust-sciter/examples folder for more complex usage.

Library documentation.

What supported right now:

Platforms:

License

Bindings library licensed under MIT license. Sciter Engine has the own license terms and end used license agreement for SDK usage.