pub struct DesktopAppBuilder { /* private fields */ }Expand description
Builder for Rust-first WebUI desktop hosts.
Source and bundle inputs share registration and window configuration. No
startup rendering occurs until Self::build, so route providers and Rust
state participate in the first render, not only subsequent requests.
Implementations§
Source§impl DesktopAppBuilder
impl DesktopAppBuilder
Sourcepub fn window(self, window: WindowOptions) -> Self
pub fn window(self, window: WindowOptions) -> Self
Set the window options used by both rendering and the native frame.
Sourcepub fn shell(self, shell: DesktopShellConfig) -> Self
pub fn shell(self, shell: DesktopShellConfig) -> Self
Set native shell configuration, overriding any bundled defaults.
Sourcepub fn app_id(self, app_id: impl Into<String>) -> Self
pub fn app_id(self, app_id: impl Into<String>) -> Self
Set the stable application identity used by the native frame.
Sourcepub fn max_asset_bytes(self, max_asset_bytes: u64) -> Self
pub fn max_asset_bytes(self, max_asset_bytes: u64) -> Self
Set the maximum asset bytes buffered in one protocol response.
Sourcepub fn state<T: Serialize>(self, state: &T) -> Result<Self>
pub fn state<T: Serialize>(self, state: &T) -> Result<Self>
Set startup state from any serializable Rust value.
§Errors
Returns DesktopError if state serialization fails.
Sourcepub fn state_value(self, state: Value) -> Self
pub fn state_value(self, state: Value) -> Self
Set startup state from an existing JSON value.
Sourcepub fn token_css(self, token_css: HashMap<String, String>) -> Self
pub fn token_css(self, token_css: HashMap<String, String>) -> Self
Set pre-resolved design token CSS.
Sourcepub fn route<F>(self, pattern: impl AsRef<str>, handler: F) -> Result<Self>
pub fn route<F>(self, pattern: impl AsRef<str>, handler: F) -> Result<Self>
Register a Rust route state provider.
Patterns support literal segments and :param captures, e.g.
/contacts/:id.
§Errors
Returns DesktopError if the pattern is invalid.
Sourcepub fn api_route<F>(self, pattern: impl AsRef<str>, handler: F) -> Result<Self>
pub fn api_route<F>(self, pattern: impl AsRef<str>, handler: F) -> Result<Self>
Register a Rust custom-protocol API handler.
Patterns support literal segments and :param captures, e.g.
/api/contacts/:id.
§Errors
Returns DesktopError if the pattern is invalid.
Sourcepub fn build(self) -> Result<DesktopFrame>
pub fn build(self) -> Result<DesktopFrame>
Render startup content and construct the owning desktop frame.
§Errors
Returns DesktopError if source compilation, bundle loading, a route
provider, or startup rendering fails.