kurogane 0.0.6-beta.1
API reference
Every public item of the kurogane crate, grouped by topic.
A composable Chromium runtime for Rust.
Build high-performance, GPU-accelerated desktop applications on Chromium or embed it directly into existing applications.
Guides, concepts and the CLI reference are at https://kurogane-rs.org/docs.
A first app
use kurogane::{App, AppHandle, IpcError};
fn greet(name: String, _: &AppHandle) -> Result<String, IpcError> {
Ok(format!("Hello, {name}!"))
}
fn main() {
App::new("content").command("greet", greet).run_or_exit();
}
The page calls the command with window.kurogane.invoke("greet", "Kurogane")
and gets "Hello, Kurogane!" back.
Where to start
Appdescribes an application and starts it.AppInstanceis the running application, owned by the thread that started it.AppHandlereaches it from any thread.BrowserHandledrives one browser.WindowOptionsdescribes an application window.
Talking to the page
App::commandregisters a command. Its async and binary forms answer later or take bytes. A handler fails with anIpcError.AppHandle::broadcast_jsonsends an event to every subscribed page.App::streamregisters aStreamHandlerfor chunks in both directions.App::permitopens a command or stream to another origin.capability::Filesystemgrants pages scoped access to files.
Deciding what a page may do
Hooks such as App::on_new_window, App::on_navigation,
App::on_download and App::on_permission take a typed request. Each
answers with a decision whose Default leaves the choice to Kurogane.
Processes
Chromium runs your binary again for each of its helper processes. Code
before the call that starts the runtime runs in every process. Guard
one-time work with is_browser_process. See App.
Your own event loop
App::start and App::start_embedded start Chromium without its
message loop. Your loop calls AppInstance::pump until
AppInstance::should_shutdown turns true and then
AppInstance::shutdown.
Topics
- App and runtimeConfigures an application, starts the runtime and reaches it once it runs.20 items
- Windows and browsersOpens windows, places them and names the browsers inside them.11 items
- IPCCommands, streams and errors between your Rust code and the page.8 items
- CapabilitiesGrants a page scoped access to the filesystem.11 items
- Requests and decisionsWhat a page or Chromium asks of your application and the answers it can give.32 items
Re-exports
The crate root re-exports these crates for applications that need them.