{"id":13439722,"url":"https://github.com/sciter-sdk/rust-sciter","last_synced_at":"2025-05-14T19:02:24.467Z","repository":{"id":41371460,"uuid":"53307067","full_name":"sciter-sdk/rust-sciter","owner":"sciter-sdk","description":"Rust bindings for Sciter","archived":false,"fork":false,"pushed_at":"2022-05-06T20:12:14.000Z","size":671,"stargazers_count":816,"open_issues_count":43,"forks_count":78,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-13T13:17:57.056Z","etag":null,"topics":["gui","htmlayout","rust-bindings","sciter","tiscript"],"latest_commit_sha":null,"homepage":"https://sciter.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sciter-sdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-07T08:02:47.000Z","updated_at":"2025-04-04T15:01:01.000Z","dependencies_parsed_at":"2022-07-19T01:02:34.606Z","dependency_job_id":null,"html_url":"https://github.com/sciter-sdk/rust-sciter","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sciter-sdk%2Frust-sciter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sciter-sdk%2Frust-sciter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sciter-sdk%2Frust-sciter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sciter-sdk%2Frust-sciter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sciter-sdk","download_url":"https://codeload.github.com/sciter-sdk/rust-sciter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254009501,"owners_count":21998983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","htmlayout","rust-bindings","sciter","tiscript"],"created_at":"2024-07-31T03:01:16.542Z","updated_at":"2025-05-14T19:02:24.447Z","avatar_url":"https://github.com/sciter-sdk.png","language":"Rust","funding_links":[],"categories":["Libraries","Rust","库 Libraries","库"],"sub_categories":["GUI","GUI GUI","图形用户界面 GUI"],"readme":"# Rust bindings for Sciter\n\n[![GHA status](https://github.com/sciter-sdk/rust-sciter/actions/workflows/cargo.yml/badge.svg?branch=master)](https://github.com/sciter-sdk/rust-sciter/actions/workflows/cargo.yml)\n[![AppVeyor status](https://ci.appveyor.com/api/projects/status/cbrisyh792mmmd08/branch/master?svg=true)](https://ci.appveyor.com/project/pravic/rust-sciter)\n[![Travis status](https://www.travis-ci.com/sciter-sdk/rust-sciter.svg?branch=master)](https://www.travis-ci.com/sciter-sdk/rust-sciter)\n[![Minimum supported Rust version](https://img.shields.io/badge/rustc-1.38+-green.svg)](https://github.com/sciter-sdk/rust-sciter/commits/master/.travis.yml)\n[![Documentation](https://docs.rs/sciter-rs/badge.svg)](https://docs.rs/sciter-rs)\n[![License](https://img.shields.io/crates/l/sciter-rs.svg)](https://crates.io/crates/sciter-rs)\n[![Join the forums at https://sciter.com/forums](https://img.shields.io/badge/forum-sciter.com-orange.svg)](https://sciter.com/forums)\n\nCheck [this page](https://sciter.com/developers/sciter-sdk-bindings/) for other language bindings (Delphi / D / Go / .NET / Python / Rust).\n\n----\n\n\n## Introduction\n\nSciter is an embeddable [multiplatform](https://sciter.com/sciter/crossplatform/) 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.\n\n\n## Screenshots\n\nCheck the [screenshot gallery](https://github.com/oskca/sciter#sciter-desktop-ui-examples) of desktop UI examples\nand [DirectX UI integration](https://github.com/pravic/rust-gfx-sciter) via [Rust GFX](https://github.com/gfx-rs/gfx).\n\n\n## Description\n\nPhysically Sciter is a mono library which contains:\n\n* [HTML and CSS](https://sciter.com/developers/for-web-programmers/) rendering engine based on the H-SMILE core used in [HTMLayout](https://terrainformatica.com/a-homepage-section/htmlayout/),\n* JavaScript in [Sciter.JS](https://sciter.com/sciter-js-is-the-mainstream-primary-version-of-sciter/),\n* JavaScript alike [Scripting engine](https://sciter.com/developers/sciter-docs/) – core of [TIScript](https://sciter.com/developers/for-web-programmers/tiscript-vs-javascript/) which by itself is based on [c-smile](https://c-smile.sourceforge.net/) engine,\n* Persistent [Database](https://sciter.com/docs/content/script/Storage.htm) (a.k.a. [JSON DB](https://terrainformatica.com/2006/10/what-the-hell-is-that-json-db/)) based on excellent DB products of [Konstantin Knizhnik](http://garret.ru/databases.html).\n* [Graphics](https://sciter.com/docs/content/sciter/Graphics.htm) module that uses native graphics primitives provided by supported platforms: Direct2D on Windows 7 and above, GDI+ on Windows XP, CoreGraphics on MacOS, Cairo on Linux/GTK. Yet there is an option to use built-in [Skia/OpenGL](https://skia.org/) backend on each platform.\n* Network communication module, it relies on platform HTTP client primitives and/or [Libcurl](https://curl.haxx.se/).\n\n\nInternally it contains the following modules:\n\n* **CSS** – CSS parser and the collection of parsed CSS rules, etc.\n* **HTML DOM** – HTML parser and DOM tree implementation.\n* **layout managers** – collection of various layout managers – text layout, default block layout, flex layouts. Support of positioned floating elements is also here. This module does the layout calculations heavy lifting. This module is also responsible for the rendering of layouts.\n* **input behaviors** – a collection of built-in behaviors – code behind \"active\" DOM elements: `\u003cinput\u003e`, `\u003cselect\u003e`, `\u003ctextarea\u003e`, etc.\n* **script module** – source-to-bytecode compiler and virtual machine (VM) with compacting garbage collector (GC). This module also contains runtime implementation of standard classes and objects: Array, Object, Function and others.\n* **script DOM** – runtime classes that expose DOM and DOM view (a.k.a. window) to the script.\n* **graphics abstraction layer** – abstract graphics implementation that isolates the modules mentioned above from the particular platform details:\n    * Direct2D/DirectWrite graphics backend (Windows);\n    * GDI+ graphics backend (Windows);\n    * CoreGraphics backend (Mac OS X);\n    * Cairo backend (GTK on all Linux platforms);\n    * Skia/OpenGL backend (all platforms)\n* **core primitives** – set of common primitives: string, arrays, hash maps and so on.\n\n\nSciter supports all standard elements defined in HTML5 specification [with some additions](https://sciter.com/developers/for-web-programmers/). CSS is extended to better support the Desktop UI development, e.g. flow and flex units, vertical and horizontal alignment, OS theming.\n\n[Sciter SDK](https://sciter.com/download/) comes with a demo \"browser\" with a builtin DOM inspector, script debugger and documentation viewer:\n\n![Sciter tools](https://sciter.com/wp-content/uploads/2015/10/dom-tree-in-inspector-640x438.png)\n\nCheck \u003chttps://sciter.com\u003e website and its [documentation resources](https://sciter.com/developers/) for engine principles, architecture and more.\n\n\n## Getting started:\n\n1. Download the [Sciter.TIS or Sciter.JS SDK](https://sciter.com/download/) and extract it somewhere.\n2. Add the corresponding target platform binaries to PATH (`bin.win`, `bin.osx` or `bin.lnx`).\n3. If you do not already have it installed, you need GTK 3 development tools installed to continue:\n    sudo apt-get install libgtk-3-dev\n4. Build the crate and run a minimal sciter sample: `cargo run --example minimal`.\n5. For your apps add the following dependency to the Cargo.toml: `sciter-rs = \"*\"`.\n\n\n## Brief look:\n\nHere is a minimal sciter app:\n\n```rust\nextern crate sciter;\n\nfn main() {\n    let mut frame = sciter::Window::new();\n    frame.load_file(\"minimal.htm\");\n    frame.run_app();\n}\n```\n\nIt looks similar to this:\n\n![Minimal sciter sample](https://i.imgur.com/ojcM5JJ.png)\n\n### Interoperability\n\nIn respect of [tiscript](https://www.codeproject.com/Articles/33662/TIScript-language-a-gentle-extension-of-JavaScript) or JavaScript functions calling:\n```rust\nuse sciter::{Element, Value};\n\nlet root = Element::from_window(hwnd);\nlet result: Value = root.call_function(\"namespace.name\", \u0026make_args!(1,\"2\",3));\n```\n\nCalling Rust from script can be implemented as following:\n```rust\nstruct Handler;\n\nimpl Handler {\n  fn calc_sum(\u0026self, a: i32, b: i32) -\u003e i32 {\n    a + b\n  }\n}\n\nimpl sciter::EventHandler for Handler {\n  dispatch_script_call! {\n    fn calc_sum(i32, i32);\n  }\n}\n```\n\nAnd we can access this function from TIScript:\n```js\n// `view` represents the window where this script is running.\n// `stdout` stream is a standard output stream (shell or debugger console, for example)\n\nstdout.printf(\"2 + 3 = %d\\n\", view.calc_sum(2, 3));\n```\n\nor from JavaScript:\n```js\n// `Window.this` represents the window where this script is running.\nconsole.log(\"2 + 3\", Window.this.xcall(\"calc_sum\", 2, 3));\n````\n\n_Check [rust-sciter/examples](https://github.com/sciter-sdk/rust-sciter/tree/master/examples) folder for more complex usage_.\n\n\n## [Library documentation](https://docs.rs/sciter-rs/).\n\n\n## What is supported right now:\n\n* [x] [sciter::window](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-window.hpp) which brings together window creation, host and event handlers.\n* [x] [sciter::host](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-host-callback.h) with basic event handling, needs to be redesigned.\n* [x] [sciter::event_handler](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-behavior.h) with event handling and auto dispatching script calls to native code.\n* [x] [sciter::dom](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-dom.hpp) for HTML DOM access and manipulation methods.\n* [x] [sciter::value](https://github.com/c-smile/sciter-sdk/blob/master/include/value.hpp) Rust wrapper.\n* [x] [sciter::behavior_factory](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-behavior.h) - global factory for native behaviors.\n* [x] [sciter::graphics](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-graphics.hpp) - platform independent graphics native interface (can be used in native behaviors).\n* [x] [sciter::request](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-request.hpp) - resource request object, used for custom resource downloading and handling.\n* [x] [sciter::video](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-video-api.h) - custom video rendering.\n* [x] [sciter::archive](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-host-callback.h) - Sciter's compressed archive produced by `sdk/bin/packfolder` tool.\n* [x] [sciter::msg](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-msg.h) - backend-independent input event processing.\n* [x] [sciter::om](https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-om.h) - Sciter Object Model, extending Sciter by native code.\n* [x] [NSE](https://sciter.com/include-library-name-native-extensions/) - native Sciter extensions.\n\n### Platforms:\n\n* [x] Windows\n* [x] OSX\n* [x] Linux\n* [x] Raspberry Pi\n\n\n## License\n\nBindings library licensed under [MIT license](https://opensource.org/licenses/MIT). Sciter Engine has the [own license terms](https://sciter.com/prices/) and [end used license agreement](https://github.com/c-smile/sciter-sdk/blob/master/license.htm) for SDK usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciter-sdk%2Frust-sciter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsciter-sdk%2Frust-sciter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciter-sdk%2Frust-sciter/lists"}