Skip to main content

App

Struct App 

Source
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: WindowMap

Bidirectional plushie ID <-> iced window ID mapping with per-window state.

§image_registry: ImageRegistry

In-memory image handles for use by Image widgets and canvas draw.

§system_theme: Theme

Current system theme, tracked via ThemeChanged subscription.

§theme_follows_system: bool

True when the app-level theme is “system” (follow OS preference).

§scale_factor: f32

Global scale factor multiplier (1.0 = follow OS DPI).

§registry: WidgetRegistry

Unified widget registry. All widget types are dispatched through this registry.

§animation_epoch: Option<Instant>

Epoch for animation_frame timestamp calculation.

§emitter: EventEmitter

Rate-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: TransitionManager

Renderer-side animation manager. Tracks transitions, springs, and exit ghosts. Advances on frame ticks and writes interpolated values to SharedState.interpolated_props.

§current_modifiers: Modifiers

Current keyboard modifier state, updated on every ModifiersChanged event. Included on all outgoing pointer events.

§codec: Codec

Wire protocol codec. Used for encoding stub acks and scripting responses. Stored here so these paths don’t need the global.

Implementations§

Source§

impl App

Source

pub fn new( registry: WidgetRegistry, effect_handler: Box<dyn EffectHandler>, sink: Arc<SinkMutex>, ) -> Self

Source

pub fn set_codec(&mut self, codec: Codec)

Set the wire protocol codec. Called during startup after codec negotiation. Defaults to MsgPack.

Source

pub fn title_for_window(&self, iced_id: Id) -> String

Source

pub fn theme_for_window(&self, iced_id: Id) -> Theme

Source

pub fn theme_ref_for_window(&self, iced_id: Id) -> &Theme

Source

pub fn theme_chrome_for_window(&self, iced_id: Id) -> ThemeChrome

Source

pub fn scale_factor_for_window(&self, iced_id: Id) -> f32

Source

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.

Source

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.

Source

pub fn lookup_widget_event_rate(&self, widget_id: &str) -> Option<u32>

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn apply(&mut self, message: IncomingMessage) -> Result<()>

Source§

impl App

Source

pub fn handle_key_pressed( &self, data: KeyEventData, iced_id: Id, ) -> Task<Message>

Source

pub fn handle_key_released( &self, data: KeyEventData, iced_id: Id, ) -> Task<Message>

Source

pub fn handle_modifiers_changed( &mut self, mods: Modifiers, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_cursor_moved( &mut self, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_cursor_entered( &self, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_cursor_left(&self, iced_id: Id, captured: bool) -> Task<Message>

Source

pub fn handle_mouse_button_pressed( &self, button: Button, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_mouse_button_released( &self, button: Button, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_wheel_scrolled( &mut self, delta: ScrollDelta, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_finger_pressed( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_finger_moved( &mut self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_finger_lifted( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_finger_lost( &self, finger: Finger, pos: Point, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_ime_opened(&self, iced_id: Id, captured: bool) -> Task<Message>

Source

pub fn handle_ime_preedit( &self, text: String, cursor: Option<Range<usize>>, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_ime_commit( &self, text: String, iced_id: Id, captured: bool, ) -> Task<Message>

Source

pub fn handle_ime_closed(&self, iced_id: Id, captured: bool) -> Task<Message>

Source

pub fn handle_window_event(&self, iced_id: Id, evt: Event) -> Task<Message>

Source§

impl App

Source

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

Source

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

Source

pub fn update(&mut self, message: Message) -> Task<Message>

Source

pub fn handle_stdin(&mut self, event: StdinEvent) -> Task<Message>

Source§

impl App

Source

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

Source

pub fn handle_widget_op(&mut self, op: &str, payload: &Value) -> Task<Message>

Dispatch a widget operation by name. Called when Core produces a WidgetOp effect. Returns an iced Task for operations that need async completion (focus, scroll, font load).

Source

pub fn handle_image_op( &mut self, op: &str, handle: &str, data: Option<Vec<u8>>, pixels: Option<Vec<u8>>, width: Option<u32>, height: Option<u32>, )

Apply an image operation (create, update, remove) to the in-memory image registry. Emits an error event on failure.

Source§

impl App

Source

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().

Source

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.

Source

pub fn dispatch_system_op(&mut self, op: SystemOp) -> Task<Message>

Dispatch a typed SystemOp.

Source

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.

Source

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.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more