Reference
Runtime Function - application
Detailed guidance for iced::application.
Runtime Function - iced::application
Authoritative source: ref/doc/iced/fn.application.html.
# Verified signature
rust
pub fn application<State, Message, Theme, Renderer>( boot: impl BootFn<State, Message>, update: impl UpdateFn<State, Message>, view: impl for<'a> ViewFn<'a, State, Message, Theme, Renderer>, ) -> Application<impl Program<State = State, Message = Message, Theme = Theme>> where State: 'static, Message: Send + 'static, Theme: Base, Renderer: Renderer,
# Use this when...
- You need explicit app boot + runtime configuration.
- You want to configure window settings, theme, fonts, subscriptions, or title.
- You are building production-oriented app startup behavior.
# Minimal example
rust
pub fn main() -> iced::Result { iced::application(App::new, App::update, App::view).run() }
# How it works
application returns a builder. You define boot/update/view once, then layer runtime concerns with chainable methods before .run().
# Common patterns
rust
pub fn main() -> iced::Result { iced::application(App::new, App::update, App::view) .title("Editor") .subscription(App::subscription) .theme(App::theme) .run() }
# Gotchas / tips
- Keep boot-time state initialization in
boot/new, not inview. - Add subscriptions from builder or app methods to keep lifecycle clear.
- Prefer
applicationoverrunonce startup behavior is non-trivial.
# Example references
ref/examples/editor/src/main.rsref/examples/layout/src/main.rsref/examples/modal/src/main.rs