pub struct App {Show 16 fields
pub core: Core,
pub theme: Theme,
pub theme_chrome: ThemeChrome,
pub pending_tasks: Vec<Task<Message>>,
pub windows: WindowMap,
pub image_registry: ImageRegistry,
pub system_theme: Theme,
pub theme_follows_system: bool,
pub scale_factor: f32,
pub registry: WidgetRegistry,
pub animation_epoch: Option<Instant>,
pub emitter: EventEmitter,
pub effect_handler: Box<dyn EffectHandler>,
pub transition_manager: TransitionManager,
pub current_modifiers: Modifiers,
pub codec: Codec,
}Expand description
The iced daemon application. Owns the rendering engine, window state, widget registry, and all runtime state needed to translate between the wire protocol and iced’s update/view cycle.
Fields§
§core: Core§theme: Theme§theme_chrome: ThemeChrome§pending_tasks: Vec<Task<Message>>Widget ops and effects return iced Tasks, but apply() doesn’t
return them. They accumulate here and are drained via Task::batch
in update() after apply() returns.
windows: WindowMapBidirectional plushie ID <-> iced window ID mapping with per-window state.
image_registry: ImageRegistryIn-memory image handles for use by Image widgets and canvas draw.
system_theme: ThemeCurrent system theme, tracked via ThemeChanged subscription.
theme_follows_system: boolTrue when the app-level theme is “system” (follow OS preference).
scale_factor: f32Global scale factor multiplier (1.0 = follow OS DPI).
registry: WidgetRegistryUnified widget registry. All widget types are dispatched through this registry.
animation_epoch: Option<Instant>Epoch for animation_frame timestamp calculation.
emitter: EventEmitterRate-limited event emitter with coalescing.
effect_handler: Box<dyn EffectHandler>Platform-specific effect handler injected at construction.
Native and WASM crates each provide their own EffectHandler
implementation.
transition_manager: TransitionManagerRenderer-side animation manager. Tracks transitions, springs, and exit ghosts. Advances on frame ticks and writes interpolated values to SharedState.interpolated_props.
current_modifiers: ModifiersCurrent keyboard modifier state, updated on every ModifiersChanged event. Included on all outgoing pointer events.
codec: CodecWire protocol codec. Used for encoding stub acks and scripting responses. Stored here so these paths don’t need the global.
Implementations§
Source§impl App
impl App
pub fn new( registry: WidgetRegistry, effect_handler: Box<dyn EffectHandler>, sink: Arc<SinkMutex>, ) -> Self
Sourcepub fn set_codec(&mut self, codec: Codec)
pub fn set_codec(&mut self, codec: Codec)
Set the wire protocol codec. Called during startup after codec negotiation. Defaults to MsgPack.
pub fn title_for_window(&self, iced_id: Id) -> String
pub fn theme_for_window(&self, iced_id: Id) -> Theme
pub fn theme_ref_for_window(&self, iced_id: Id) -> &Theme
pub fn theme_chrome_for_window(&self, iced_id: Id) -> ThemeChrome
pub fn scale_factor_for_window(&self, iced_id: Id) -> f32
Sourcepub fn emit_subscription(
&self,
key: &str,
captured: bool,
event_fn: impl Fn(&str) -> OutgoingEvent,
) -> Task<Message>
pub fn emit_subscription( &self, key: &str, captured: bool, event_fn: impl Fn(&str) -> OutgoingEvent, ) -> Task<Message>
Emit a subscription event to all matching entries (specific kind + catch-all SUB_EVENT), filtered by window_id. The event_fn is called once per matching entry with the entry’s tag.
event_fn receives the tag as &str; the OutgoingEvent constructor
allocates the owned tag internally via impl Into<String>. Earlier
versions cloned the tag at the call site before passing it in.
Sourcepub fn emit_subscription_for_window(
&self,
key: &str,
window_id: Option<&str>,
captured: bool,
event_fn: impl Fn(&str) -> OutgoingEvent,
) -> Task<Message>
pub fn emit_subscription_for_window( &self, key: &str, window_id: Option<&str>, captured: bool, event_fn: impl Fn(&str) -> OutgoingEvent, ) -> Task<Message>
Emit a subscription event scoped to a specific window.
pub fn lookup_widget_event_rate(&self, widget_id: &str) -> Option<u32>
Sourcepub fn is_widget_disabled_for_interception(&self, widget_id: &str) -> bool
pub fn is_widget_disabled_for_interception(&self, widget_id: &str) -> bool
True when the widget at widget_id is declared disabled and is
of a type that participates in functional disabled interception.
iced’s native Status::Disabled is style-only: events still reach
update() from widgets the user considers disabled. This helper
lets the dispatcher swallow events for input-family widgets so
disabled: true blocks interaction as every host SDK documents.
Widget types in scope: text_input, text_editor, combo_box,
pick_list. Extending coverage to other widgets (e.g. slider)
is a future step once their behaviour is audited.
Sourcepub fn coalesce_subscription(
&mut self,
key: &str,
captured: bool,
event_fn: impl Fn(&str) -> OutgoingEvent,
) -> Task<Message>
pub fn coalesce_subscription( &mut self, key: &str, captured: bool, event_fn: impl Fn(&str) -> OutgoingEvent, ) -> Task<Message>
Coalesce a subscription event for all matching entries.
Sourcepub fn coalesce_subscription_for_window(
&mut self,
key: &str,
window_id: Option<&str>,
captured: bool,
event_fn: impl Fn(&str) -> OutgoingEvent,
) -> Task<Message>
pub fn coalesce_subscription_for_window( &mut self, key: &str, window_id: Option<&str>, captured: bool, event_fn: impl Fn(&str) -> OutgoingEvent, ) -> Task<Message>
Coalesce a subscription event scoped to a specific window. Each matching entry gets its own coalesce buffer (keyed by tag) so rate limiting is isolated per subscription entry.
Sourcepub fn dispatch_widget_subscription(
&mut self,
kind: &str,
window_id: Option<&str>,
msg: &Message,
) -> Task<Message>
pub fn dispatch_widget_subscription( &mut self, kind: &str, window_id: Option<&str>, msg: &Message, ) -> Task<Message>
Route a Message to every widget with an active subscription
for kind (optionally scoped to window_id) and emit the
resulting outgoing events.
Fast path: returns Task::none when no widget cares about
kind, so handlers can call this unconditionally without
cloning message payloads in the common case.
Source§impl App
impl App
pub fn handle_key_pressed( &self, data: KeyEventData, iced_id: Id, ) -> Task<Message>
pub fn handle_key_released( &self, data: KeyEventData, iced_id: Id, ) -> Task<Message>
pub fn handle_modifiers_changed( &mut self, mods: Modifiers, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_cursor_moved( &mut self, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_cursor_entered( &self, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_cursor_left(&self, iced_id: Id, captured: bool) -> Task<Message>
pub fn handle_wheel_scrolled( &mut self, delta: ScrollDelta, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_finger_pressed( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_finger_moved( &mut self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_finger_lifted( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_finger_lost( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_ime_opened(&self, iced_id: Id, captured: bool) -> Task<Message>
pub fn handle_ime_preedit( &self, text: String, cursor: Option<Range<usize>>, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_ime_commit( &self, text: String, iced_id: Id, captured: bool, ) -> Task<Message>
pub fn handle_ime_closed(&self, iced_id: Id, captured: bool) -> Task<Message>
pub fn handle_window_event(&self, iced_id: Id, evt: Event) -> Task<Message>
Source§impl App
impl App
Sourcepub fn execute(&mut self, op: RendererOp) -> Task<Message>
pub fn execute(&mut self, op: RendererOp) -> Task<Message>
Execute a typed renderer operation.
Returns an iced Task for operations that need async completion (focus, scroll, effects, window queries).
Source§impl App
impl App
Sourcepub fn renderer_subscriptions(&self) -> Subscription<Message>
pub fn renderer_subscriptions(&self) -> Subscription<Message>
Build renderer subscriptions (everything except platform-specific input sources like stdin). The binary crate combines this with its own input subscription.
Source§impl App
impl App
pub fn update(&mut self, message: Message) -> Task<Message>
pub fn handle_stdin(&mut self, event: StdinEvent) -> Task<Message>
Source§impl App
impl App
Sourcepub fn view_window(&self, iced_id: Id) -> Element<'_, Message>
pub fn view_window(&self, iced_id: Id) -> Element<'_, Message>
Render a single window’s UI tree into iced Elements.
Called by the iced daemon for each open window on every frame.
Source§impl App
impl App
Source§impl App
impl App
Sourcepub fn dispatch_window_op(&mut self, op: WindowOp) -> Task<Message>
pub fn dispatch_window_op(&mut self, op: WindowOp) -> Task<Message>
Dispatch a typed WindowOp.
Each variant maps to the appropriate iced window operation. The
window id is looked up in self.windows; unknown ids are logged
and produce Task::none().
Sourcepub fn dispatch_window_query(&mut self, q: WindowQuery) -> Task<Message>
pub fn dispatch_window_query(&mut self, q: WindowQuery) -> Task<Message>
Dispatch a typed WindowQuery. Each variant produces a
response event via the emitter sink when the underlying iced
task resolves.
Sourcepub fn dispatch_system_query(&mut self, q: SystemQuery) -> Task<Message>
pub fn dispatch_system_query(&mut self, q: SystemQuery) -> Task<Message>
Dispatch a typed SystemQuery. Responses are emitted via the
sink when the underlying iced task resolves.
Sourcepub fn sync_windows(&mut self) -> Task<Message>
pub fn sync_windows(&mut self) -> Task<Message>
Compare the set of window nodes in the tree against the currently open windows and open/close as needed.
Sourcepub fn window_settings_for(&self, window_id: &str) -> Settings
pub fn window_settings_for(&self, window_id: &str) -> Settings
Build window::Settings from a window node’s props.
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl !UnwindSafe for App
impl Unpin for App
impl UnsafeUnpin for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more