Docs.rs
  • browser-window-0.12.3
    • browser-window 0.12.3
    • Permalink
    • Docs.rs crate page
    • MIT
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • bamidev
    • Dependencies
      • browser-window-c =0.3.2 normal
      • futures-channel ^0.3 normal
      • glib ^0.18 normal optional
      • gtk ^0.18 normal optional
      • javascriptcore-rs ^1 normal optional
      • json ^0.12 normal
      • lazy_static ^1 normal
      • num-bigfloat ^1 normal
      • unsafe-send-sync ^0.1 normal
      • webkit2gtk ^2.0 normal optional
      • webview2 ^0.1 normal optional
      • winapi ^0.3 normal optional
      • serde_json ^1.0 dev
      • tokio ^1.0 dev
    • Versions
    • 41.11% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate browser_window

browser_window0.12.3

  • All Items

Sections

  • Getting Started
  • Thread safety
  • Events

Crate Items

  • Modules
  • Structs
  • Enums
  • Traits

Crates

  • browser_window

Crate browser_window

Source
Expand description

BrowserWindow is a Rust crate that allows you to utilize a browser engine to build graphical interfaces, similar to Electron.js. You create your user interface with HTML, CSS and JavaScript. Then, you can communicate information to JavaScript and back to Rust.

Pick the underlying browser framework by setting feature cef, webkitgtk or edge2. For more info on which on you should choose and how to set them up, check this guide.

§Getting Started

To start building apps with Browser Window, take a look at the application module, or this quick example:

use browser_window::{application::*, browser::*, prelude::*};
 
fn main() {
	let app = Application::initialize(&ApplicationSettings::default()).unwrap();
	let runtime = app.start();
	runtime.run_async(|app| async move {
		let mut bwb = BrowserWindowBuilder::new(Source::File("file:///my-file.html".into()));
		bwb.dev_tools(true);
		bwb.size(800, 600);
		bwb.title("Example");
		let bw = bwb.build_async(&app).await;
        bw.on_message().register_async(|h, e| async move {
            match e.cmd.as_str() {
                "command_one" => {
                    h.eval_js(&format!(
                        "js_function({}, {}, {})",
                        1,
                        "'two'",
                        JsValue::String("𝟛\n".into()) // Gets properly formatted to a JS string
                                                      // literal
                    ));
                }
                "command_two" => {
                    // ... do something else here ...
                }
                _ => {}
            }
        });
 
        bw.show();
	});
	app.finish();
}

For more detailed example code, see this example code.

§Thread safety

To use the threadsafe version of BrowserWindow, enable feature threadsafe. This will use Arc instead of Rc internally, and will enable the BrowserWindowThreaded and ApplicationHandleThreaded handles. It will also require closures to be Send. Docs.rs will show the threadsafe versions of everything. If you need to know how everything is compiled in the non-threadsafe version, you need to invoke cargo doc --open in the git repo yourself.

§Events

To learn how to use events, take a quick look at the event module.

Modules§

application
This module contains runtime and application related handles.
browser
This module contains all browser related handles and stuff.
cookie
Module for dealing with cookies.
error
Error types.
event
This module contains all event related types.
javascript
prelude
Some common traits that need to be often available.
window
This module contains all window related functionality.

Structs§

DelegateFuture
This future executes a closure on the GUI thread and returns the result.
DelegateFutureFuture
This future runs a future on the GUI thread and returns its output.

Enums§

DelegateError
The error that occurs when you’re delegating work to the GUI thread, but it fails to finish and/or return a result.

Traits§

HasHandle

Results

Settings
Help

Type "browser_window" not found. Showing results for closest type name "browserwindow" instead.

    extern crate
    browser_window
    BrowserWindow is a Rust crate that allows you to utilize a …
    struct
    browser_window::browser::BrowserWindow
    trait
    browser_window::prelude::BrowserWindowExt
    struct
    browser_window::prelude::BrowserWindowImpl
    struct
    browser_window::browser::BrowserWindowOwner
    An owned browser window handle. When this handle goes out …
    struct
    browser_window::browser::BrowserWindowHandle
    This is a handle to an existing browser window.
    struct
    browser_window::browser::BrowserWindowBuilder
    Used to create a BrowserWindow or BrowserWindowThreaded …
    struct
    browser_window::browser::BrowserWindowThreaded
    Note: Only available with feature threadsafe enabled.
    type alias
    browser_window::browser::BrowserWindowEventHandler
    method
    browser_window::browser::BrowserWindow::clone
    &BrowserWindow -> BrowserWindow
    method
    browser_window::browser::BrowserWindow::on_message
    &BrowserWindow -> MessageEvent
    The event that will fire whenever invoke_extern is called …
    method
    browser_window::browser::BrowserWindow::on_tooltip
    &BrowserWindow -> TooltipEvent
    Whenever the browser is about to show a tooltip
    method
    browser_window::browser::BrowserWindow::on_key_press
    &BrowserWindow -> KeyPressEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_file_dialog
    &BrowserWindow -> FileDialogEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_key_pressed
    &BrowserWindow -> KeyPressedEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_navigation_end
    &BrowserWindow -> NavigationEndEvent
    Whenever navigation has finished and the page has loaded.
    method
    browser_window::browser::BrowserWindow::on_start_dragging
    &BrowserWindow -> StartDraggingEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_status_message
    &BrowserWindow -> StatusMessageEvent
    method
    browser_window::browser::BrowserWindow::on_address_changed
    &BrowserWindow -> AddressChangedEvent
    Whenver the address URI changes
    method
    browser_window::browser::BrowserWindow::on_console_message
    &BrowserWindow -> ConsoleMessageEvent
    When a console message is printend.
    method
    browser_window::browser::BrowserWindow::on_favicon_changed
    &BrowserWindow -> FaviconChangedEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_auth_credentials
    &BrowserWindow -> AuthCredentialsEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_download_started
    &BrowserWindow -> DownloadStartedEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_navigation_start
    &BrowserWindow -> NavigationStartEvent
    Whenever navigation to a new link happens.
    method
    browser_window::browser::BrowserWindow::on_certificate_error
    &BrowserWindow -> CertificateErrorEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_download_progress
    &BrowserWindow -> DownloadProgressEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_page_title_changed
    &BrowserWindow -> PageTitleChangedEvent
    Whenver the page title changes.
    method
    browser_window::browser::BrowserWindow::on_scroll_offset_changed
    &BrowserWindow -> ScrollOffsetChangedEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_text_selection_changed
    &BrowserWindow -> TextSelectionChangedEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::on_fullscreen_mode_changed
    &BrowserWindow -> FullscreenModeChangedEvent
    Whenever the browser goes into or out of full screen mode.
    method
    browser_window::browser::BrowserWindow::on_loading_progress_changed
    &BrowserWindow -> LoadingProgressChangedEvent
    Loading progress updates
    method
    browser_window::browser::BrowserWindow::on_select_client_certificate
    &BrowserWindow -> SelectClientCertificateEvent
    Not implemented yet.
    method
    browser_window::browser::BrowserWindow::deref
    &BrowserWindow -> &Deref::Target
    method
    browser_window::browser::BrowserWindow::handle
    &BrowserWindow -> &ApplicationHandle
    method
    browser_window::browser::BrowserWindowBuilder::build_async
    BrowserWindowBuilder, &ApplicationHandle -> BrowserWindow
    Creates the browser window.
    method
    browser_window::browser::BrowserWindowBuilder::build
    BrowserWindowBuilder, &ApplicationHandle -> BrowserWindow
    method
    browser_window::browser::BrowserWindow::clone
    &BrowserWindow -> BrowserWindow