Runtime

run

Run a view in a window on Wayland, rendered by Impeller, until the window closes.

FNcrownui::run
main.rs
use crownui::prelude::*;
 
fn main() -> Result<(), crownui::RunError> {
    crownui::run(
        component(|cx| text("Hello")),
        AppConfig::new("Hello").size(480, 320),
    )
}
Signature
pub fn run(root: impl View, config: AppConfig) -> Result<(), RunError>

run opens one window, lays it out with taffy and renders it with Impeller until the window closes.

Parameters

rootimpl Viewrequired

The view to show. Usually a component(|cx| ..) whose closure builds the UI once.

configAppConfigrequired

Window options, built from AppConfig::new(title).

Show builder methods
size(u32, u32)

Initial window size in logical pixels.

min_size(u32, u32)

Smallest size the window can be resized to.

app_idimpl Into<String>

The Wayland app id used by the compositor and the launcher.

font(Vec<u8>, Option<&str>)

Registers a font, with an optional family alias.

layerLayerOptions

Turns the app into a panel, dock or overlay on the desktop shell.

mcpbool

Turns the in-app MCP server on or off.

Returns

Ok(())()

The window was closed.

ErrRunError

The graphics backend, the platform or a thread failed to start.

Several windows

crownui::run_windows(vec![..]) takes (AnyView, AppConfig) pairs and runs until the last window closes. Each window has its own UI, so signals are not shared between them.