webui-rs 0.1.0

A lightweight, idiomatic Rust wrapper for WebUI.
Documentation
  • Coverage
  • 97.14%
    34 out of 35 items documented0 out of 21 items with examples
  • Size
  • Source code size: 39.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 851.99 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 46s Average build duration of successful builds.
  • all releases: 46s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • felixmaker/webui-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • felixmaker

webui-rs

webui-rs provides unofficial, lightweight Rust bindings for WebUI, allowing you to use any web browser or WebView as a GUI for your Rust applications.

[!NOTE]
This is an unofficial implementation. If you are looking for the official crate, please visit rust-webui.

Quick Start

cargo add webui-rs

Example

use webui::*;

fn main() -> Result<(), WebUIError> {
    let window = Window::new();

    // Bind a Rust closure to a JavaScript function
    window.bind("say_hello", |_| println!("Hello, world!"));

    // Show the window with embedded HTML
    window.show(r#"
        <html>
            <head>
                <title>Hello, world!</title>
                <script src="webui.js"></script>
            </head>
            <body>
                <button onclick="say_hello()">Click Me!</button>
            </body>
        </html>
    "#)?;

    // Wait until all windows are closed
    wait();
    Ok(())
}

Why this crate?

While official bindings exist, webui-rs focuses on:

  • Idiomatic Rust: A more natural API for Rust developers.
  • Simplicity: Minimal abstraction layers over the C library.

License

This project is licensed under the MIT License.