[][src]Crate alcro

Alcro

Alcro is a library to create desktop apps using rust and modern web technologies. It uses the existing chrome installation for the UI.

Example

#![windows_subsystem = "windows"]
use alcro::{UIBuilder, Content};
use serde_json::to_value;

let ui = UIBuilder::new().content(Content::Html("<html><body>Close Me!</body></html>")).run();
assert_eq!(ui.eval("document.body.innerText").unwrap(), "Close Me!");

//Expose rust function to js
ui.bind("product",|args| {
    let mut product = 1;
    for arg in args {
        match arg.as_i64() {
            Some(i) => product*=i,
            None => return Err(to_value("Not number").unwrap())
        }
    }
    Ok(to_value(product).unwrap())
});

assert_eq!(ui.eval("(async () => await product(1,2,3))();").unwrap(), 6);
assert!(ui.eval("(async () => await product(1,2,'hi'))();").is_err());
ui.wait_finish();

Re-exports

pub use locate::tinyfiledialogs as dialog;

Structs

Bounds

A struct that stores the size, position and window state of the browser window.

UI

The browser window

UIBuilder

Builder for constructing a UI instance.

Enums

Content

Specifies the type of content shown by the browser

WindowState

The state of the window

Type Definitions

JSObject

A JS object. It is an alias for serde_json::Value. See it's documentation for how to use it.

JSResult

The result of a JS function.