Skip to main content

Ui

Struct Ui 

Source
pub struct Ui<B: Backend> {
    pub layout_tree: LayoutTree,
    pub layout_nodes: HashMap<WidgetId, LayoutNodeId>,
    /* private fields */
}
Expand description

Cross-platform UI manager over a concrete backend implementation.

Fields§

§layout_tree: LayoutTree

Repository-owned layout tree.

§layout_nodes: HashMap<WidgetId, LayoutNodeId>

Mapping of WidgetId to owned LayoutNodeId.

Implementations§

Source§

impl<B: Backend> Ui<B>

Source

pub fn operation_pending(&self, id: OperationId) -> bool

Whether the operation is still pending (allocated and not completed).

Source

pub fn cancel_operation(&mut self, id: OperationId) -> bool

Cancels a pending operation; reports false for unknown or already finished ids (best-effort cancellation §7).

Source

pub fn complete_operation(&mut self, id: OperationId) -> bool

Marks an operation completed; reports false for stale ids, which callers ignore instead of erroring.

Source

pub fn host_advanced_control( &mut self, host: WidgetId, family: AdvancedFamily, ) -> GuiResult<AdvancedHostCapabilities>

Calls the base hosting hook on the backend.

Source§

impl<B: Backend> Ui<B>

Source

pub fn new(backend: B) -> Self

Creates a new UI manager using the given backend.

Source

pub fn backend(&self) -> &B

Returns an immutable reference to the backend.

Source

pub fn backend_mut(&mut self) -> &mut B

Returns a mutable reference to the backend.

Source

pub fn into_backend(self) -> B

Consumes Ui and returns the owned backend.

Source

pub fn create_with( &mut self, kind: WidgetKind, configure: impl FnOnce(&mut WidgetSpec), ) -> GuiResult<WidgetId>

Creates a widget from a configured WidgetSpec.

The Ui allocates the identifier and keeps it authoritative: a closure that writes spec.id cannot break the bookkeeping. configure may set creation-time-only fields — toolbar_orientation (Win32 applies CCS_VERT when the native control is created), toolbar items, colors, size, position, selected_index, parent — that the set_* accessors can only update after creation; the set_* path stays the live-update route.

Source

pub fn create( &mut self, kind: WidgetKind, text: Option<&str>, ) -> GuiResult<WidgetId>

Creates a widget and returns its identifier.

text is optional and interpreted by each widget/backend.

Source

pub fn create_menu(&mut self) -> GuiResult<MenuId>

Creates a new menu and returns its identifier.

Source

pub fn add_submenu( &mut self, parent_id: MenuId, text: &str, ) -> GuiResult<MenuId>

Source

pub fn add_menu_item( &mut self, menu_id: MenuId, text: &str, ) -> GuiResult<MenuItemId>

Adds an item to an existing menu.

Source

pub fn add_menu_item_with_shortcut( &mut self, menu_id: MenuId, text: &str, shortcut: Option<&str>, ) -> GuiResult<MenuItemId>

Adds an item to an existing menu with an optional keyboard shortcut.

Source

pub fn attach_menu_to_window( &mut self, window_id: WidgetId, menu_id: MenuId, ) -> GuiResult<()>

Attaches a menu to a window widget.

Source

pub fn set_menu_item_enabled( &mut self, item_id: MenuItemId, enabled: bool, ) -> GuiResult<()>

Enables or disables a menu item so state-dependent commands (Undo, Redo, Clear) grey out instead of looking actionable.

Backends without a native mapping return GuiError::UnsupportedCapability instead of a silent no-op.

Source

pub fn set_menu_item_text( &mut self, item_id: MenuItemId, text: &str, ) -> GuiResult<()>

Relabels a menu item in place.

State-driven menus (a recent-files list, session lists, plugin menus) update existing rows instead of closing and rebuilding the bar. The item must already exist; a lane without a native mapping answers the typed dynamic_menu_items capability error.

Source

pub fn insert_menu_item( &mut self, menu_id: MenuId, index: usize, text: &str, ) -> GuiResult<MenuItemId>

Inserts an item into an existing menu at index.

An index past the end appends, matching the slice-insert rule the bookkeeping uses, so a stale index can never panic a lane.

Source

pub fn insert_menu_item_with_shortcut( &mut self, menu_id: MenuId, index: usize, text: &str, shortcut: Option<&str>, ) -> GuiResult<MenuItemId>

Inserts an item with an optional keyboard shortcut at index.

Source

pub fn remove_menu_item(&mut self, item_id: MenuItemId) -> GuiResult<()>

Removes a menu item from its menu.

Any on_menu_item_selected callback registered for the item is dropped with it, so a stale row cannot fire into a dead handler.

Source

pub fn remove_submenu(&mut self, submenu_id: MenuId) -> GuiResult<()>

Detaches a submenu from its parent and drops it.

The submenu’s own rows and their callbacks go with it, mirroring remove_menu_item. Menus created with create_menu have no parent and are rejected.

Source

pub fn attach_context_menu( &mut self, widget_id: WidgetId, menu_id: MenuId, ) -> GuiResult<()>

Attaches a menu as a right-click context menu on any widget.

Selecting an entry emits the usual UiEvent::MenuItemSelected with the same MenuId/MenuItemId pair that the menu bar would produce.

Source

pub fn create_tray_icon(&mut self, tooltip: &str) -> GuiResult<TrayIconId>

Creates a system tray icon with the given tooltip.

The icon starts on the platform default image; pass pixels with Ui::create_tray_icon_with_icon or update them later with Ui::set_tray_icon_icon.

Source

pub fn create_tray_icon_with_icon( &mut self, tooltip: &str, icon_bytes: Vec<u8>, ) -> GuiResult<TrayIconId>

Creates a system tray icon with the given tooltip and icon pixels.

icon_bytes travels to the backend through TrayIconSpec::icon_bytes, so the payload uses the shared encoding contract documented there: a square straight-alpha RGBA raster, or an encoded container the lane recognises. Cocoa decodes either; Win32 consumes the RGBA raster. A lane that cannot decode the payload fails this call rather than silently showing an image the application never asked for.

Source

pub fn destroy_tray_icon(&mut self, id: TrayIconId) -> GuiResult<()>

Destroys a system tray icon by id.

Source

pub fn set_tray_icon_tooltip( &mut self, id: TrayIconId, tooltip: &str, ) -> GuiResult<()>

Updates the hover tooltip for a system tray icon.

Source

pub fn set_tray_icon_menu( &mut self, id: TrayIconId, menu: Option<MenuId>, ) -> GuiResult<()>

Attaches or detaches a context menu for a system tray icon.

Source

pub fn set_tray_icon_visible( &mut self, id: TrayIconId, visible: bool, ) -> GuiResult<()>

Shows or hides a system tray icon.

Source

pub fn set_tray_icon_icon( &mut self, id: TrayIconId, icon_bytes: Option<Vec<u8>>, ) -> GuiResult<()>

Replaces the icon pixels of a system tray icon.

None restores the platform default image. The stored specification is only updated once the backend accepted the new payload, so a lane that cannot swap icon pixels reports GuiError::UnsupportedCapability and leaves the icon unchanged.

Source

pub fn tray_icon(&self, id: TrayIconId) -> Option<&TrayIconSpec>

Returns the specification of a registered system tray icon, if present.

Source

pub fn tray_icons(&self) -> &HashMap<TrayIconId, TrayIconSpec>

Returns a map of all currently registered system tray icons.

Source

pub fn show_confirm_dialog( &mut self, title: &str, message: &str, ) -> GuiResult<u64>

Shows a modal Yes/No confirm dialog and returns a token identifying it. The answer arrives as UiEvent::DialogResponse { token, confirmed } from the event queue. When a focused widget or window is available, its assistive technology receives an announcement before the modal backend call begins.

Source

pub fn show_file_dialog(&mut self, request: FileDialog) -> GuiResult<u64>

Opens a native file dialog without creating a widget (dogfood report #5) and returns a token. The answer arrives as UiEvent::FileDialogResponse { token, paths }; paths is empty when the user cancelled. Lanes without a function-style dialog report GuiError::UnsupportedCapability("file_dialog") (Win32 and Cocoa today); the FileChooserDialog widget keeps working everywhere.

use native_gui_core::file_dialog::FileDialog;
let token = ui.show_file_dialog(
    FileDialog::save()
        .title("Save jobs")
        .filter("JSON", &["*.json"])
        .suggested_name("jobs.json"),
)?;
// later: UiEvent::FileDialogResponse { token, paths } => ...
Source

pub fn native_window_handle( &self, window_id: WidgetId, ) -> GuiResult<NativeWindowHandle>

Returns the platform handles of a top-level window, for interop with renderers and native APIs (found while dogfooding).

The window must exist and be realized (shown at least once). Backends without support (Mock, TUI, Web, and currently Win32/Cocoa unless they implement it) return GuiError::UnsupportedCapability. See also Ui::window_handle behind the raw-window-handle feature.

Source

pub fn set_close_guard( &mut self, widget_id: WidgetId, guarded: bool, ) -> GuiResult<()>

Enables or disables close-request interception for a window (GH-056).

A guarded window reports UiEvent::CloseRequested instead of closing; the app answers the request (for example through Ui::show_confirm_dialog) and approves a close by disabling the guard and calling Ui::remove. Lanes without interception return GuiError::UnsupportedCapability.

Source

pub fn timer_capabilities(&self) -> TimerCapabilities

Reports timer operations available on this backend.

Source

pub fn motion_capabilities(&self) -> MotionCapabilities

Reports timer-driven motion support on this backend.

Source

pub fn start_motion( &mut self, widget_id: WidgetId, spec: MotionSpec, ) -> GuiResult<MotionId>

Starts a linear motion driven by the backend’s timer event loop.

Coalesced ticks use a bounded 16 ms cadence. The first tick is at min(duration, 16 ms) and completion is reported at the first tick at or after duration. Zero duration is invalid; exhausted motion/timer IDs and a backend deadline that overflows its clock return errors without registering a motion.

Source

pub fn cancel_motion(&mut self, motion: MotionId) -> GuiResult<()>

Cancels a live motion and purges any not-yet-delivered progress events.

Source

pub fn start_timer(&mut self, spec: TimerSpec) -> GuiResult<TimerId>

Starts a one-shot or repeating timer on the UI event loop.

Source

pub fn start_widget_timer( &mut self, widget_id: WidgetId, spec: TimerSpec, stop_policy: TimerStopPolicy, ) -> GuiResult<TimerId>

Starts a timer whose lifecycle follows a widget’s removal/hide policy.

Source

pub fn cancel_timer(&mut self, timer: TimerId) -> GuiResult<()>

Cancels a live timer; unknown, cancelled, or fired ids use the backend’s Timer not found: {id} error convention.

Source

pub fn window_capabilities(&self) -> WindowCapabilities

Reports the extended window features available from this backend.

Source

pub fn set_window_options( &mut self, widget_id: WidgetId, options: WindowOptions, ) -> GuiResult<()>

Validates and applies portable options to a top-level window.

Source

pub fn window_options(&self, widget_id: WidgetId) -> GuiResult<WindowOptions>

Returns the options last applied to a window, or the portable defaults.

Source

pub fn dismiss_popup(&mut self, widget_id: WidgetId) -> GuiResult<()>

Hides an active popup at the backend without reporting a user-dismissal event.

User- and OS-initiated dismissals arrive separately as UiEvent::PopupDismissed.

Source

pub fn set_text(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>

Updates text content for a widget.

An embedded NUL is rejected before the spec or the backend changes. Native string APIs (SetWindowTextW, GTK C strings, NSString) truncate at the first NUL, so accepting one would store a suffix the control never shows.

Source

pub fn set_label_alignment( &mut self, widget_id: WidgetId, alignment: LabelAlignment, ) -> GuiResult<()>

Sets horizontal alignment for a label.

The value is stored only after the backend accepts it, so a lane without this mapping leaves the shared spec unchanged.

Source

pub fn set_label_wrap( &mut self, widget_id: WidgetId, wrap: LabelWrap, ) -> GuiResult<()>

Sets the line-wrapping mode for a label.

The value is stored only after the backend accepts it, so an unsupported wrapping mode leaves the shared spec unchanged.

Source

pub fn text_selection(&self, widget_id: WidgetId) -> GuiResult<(usize, usize)>

Reads the live text selection, in Unicode characters (not bytes/UTF-16).

Source

pub fn set_text_selection( &mut self, widget_id: WidgetId, start: usize, end: usize, ) -> GuiResult<()>

Selects a character range in a text control.

Offsets are character positions (Unicode scalar values): start inclusive, end exclusive, so (0, 0) places a caret at the start. The range is mirrored in the widget spec and forwarded to the backend’s native selection mapping (TextInput, TextArea, RichText).

Source

pub fn set_text_completion_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>

Sets the completion/suggestion item list for a TextInput.

The shared model stores the full list and the backend applies it to its native completion source; the lane owns filtering and its popup (see docs/widget-expansion-roadmap.md, “TextInput completion”). The call is transactional: the shared spec records items only after the backend accepted them, so a lane without a completion mapping (typed GuiError::UnsupportedCapability with the "text_completion" identifier) leaves the model exactly as it was.

Source

pub fn set_placeholder_text( &mut self, widget_id: WidgetId, text: &str, ) -> GuiResult<()>

Sets placeholder/hint text on a TextInput widget.

An embedded NUL is rejected before the spec or the backend changes: cue-banner APIs (EM_SETCUEBANNER, GTK placeholder, AppKit setPlaceholderString:) truncate at the first NUL.

Source

pub fn set_monospace( &mut self, widget_id: WidgetId, monospace: bool, ) -> GuiResult<()>

Sets monospace font rendering on a supported widget (TextArea, TextInput, Label, RichText).

Source

pub fn set_font( &mut self, widget_id: WidgetId, font: Option<&FontDescriptor>, ) -> GuiResult<()>

Sets an explicit font family, size, weight, and slant on a supported widget (Label, Button, TextInput, TextArea).

Passing None clears the custom font back to the active theme/platform default.

Source

pub fn set_row_icons( &mut self, widget_id: WidgetId, icons: &[Option<IconRole>], ) -> GuiResult<()>

Sets per-row IconRole icons on a DataList or ListView widget.

Each slot aligns by row index (None omits an icon for that row); passing an empty slice clears all row icons.

Source

pub fn set_spell_check( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>

Enables or disables the native control’s built-in spell checking on a TextArea or RichText (NSTextView continuous checking, RichEdit IMF_SPELLCHECKING). No dictionary engine is bundled: lanes whose control has no built-in checker (GTK4 GtkTextView, TUI, Web) return GuiError::UnsupportedCapability.

Source

pub fn set_rich_text_runs( &mut self, widget_id: WidgetId, runs: &[TextRun], ) -> GuiResult<()>

Sets styled text runs on a RichText widget.

Source

pub fn set_rich_text_images( &mut self, widget_id: WidgetId, images: &[RichTextImage], ) -> GuiResult<()>

Sets inline images on a RichText widget.

Source

pub fn set_checked( &mut self, widget_id: WidgetId, checked: bool, ) -> GuiResult<()>

Updates checked state for a widget that supports it.

Source

pub fn set_value(&mut self, widget_id: WidgetId, value: i32) -> GuiResult<()>

Sets numeric value for widgets that support it.

Source

pub fn set_range( &mut self, widget_id: WidgetId, min: i32, max: i32, ) -> GuiResult<()>

Sets numeric range for widgets that support it.

Source

pub fn set_step(&mut self, widget_id: WidgetId, step: i32) -> GuiResult<()>

Sets step value for widgets that support it.

Source

pub fn set_selected_index( &mut self, widget_id: WidgetId, index: usize, ) -> GuiResult<()>

Sets selected index for widgets that support item/page selection.

On a widget with keyed rows, the index is also mapped to its RowKey so a later Self::set_rows_keyed follows the selection by identity instead of by position.

Source

pub fn set_tab_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>

Sets page labels for a tabs widget.

Labels follow the attached pages in attach order; pages without a label keep the backend placeholder header. The WYSIWYG inspector and app code can now drive WidgetSpec.tab_items at runtime.

Source

pub fn min_tabs_height(&self, widget_id: WidgetId) -> f32

Resolves the dynamic minimum height floor for a Tabs widget strip.

If the backend provides a positive natural height for the widget (e.g. measured tab strip typography, platform theme metrics, or DPI-scaled tab buttons), that height is used as the floor. Otherwise, falls back to MIN_TABS_HEIGHT (30.0 pt).

Source

pub fn tabs_min_height(&self, widget_id: WidgetId) -> f32

Alias for Self::min_tabs_height for ergonomic naming.

Source

pub fn set_selected_indices( &mut self, widget_id: WidgetId, indices: &[usize], ) -> GuiResult<()>

Sets multiple selected indices for multi-select list/tree widgets.

On a widget with keyed rows, the indices are also mapped to their RowKeys so a later Self::set_rows_keyed keeps the surviving members selected.

Source

pub fn set_row_drag( &mut self, widget_id: WidgetId, source: bool, target: bool, ) -> GuiResult<()>

Enables/disables row drag-source and drop-target behavior on a row widget (ListView/DataList/DataGrid/TreeView).

Drags started from a source widget emit UiEvent::DragStarted with the dragged row indices; dropping onto a target emits UiEvent::Dropped with the hit-tested target_index and the source_indices.

Source

pub fn set_drag_source( &mut self, widget_id: WidgetId, options: DragSourceOptions, ) -> GuiResult<()>

Configures an additive text/custom-MIME drag source.

MIME values are normalized to lowercase and duplicate kinds are removed while preserving preference order. Existing row drags remain configured independently through Self::set_row_drag.

Source

pub fn set_drag_target_options( &mut self, widget_id: WidgetId, options: DragTargetOptions, ) -> GuiResult<()>

Configures accepted text/custom-MIME kinds and the requested drop effect.

This is separate from Self::set_drop_target, which retains its existing boolean file/URL/text API.

Source

pub fn drag_capabilities(&self) -> DragCapabilities

Reports support for text, custom-MIME, feedback, and preview operations.

Source

pub fn set_file_drop_target( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>

Enables/disables accepting external file drops from the OS shell.

When enabled, files dragged and dropped from native shell file managers (e.g. Windows Explorer, macOS Finder, GNOME Files/Nautilus) emit UiEvent::FilesDropped { widget_id, paths }.

Source

pub fn set_drop_target( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>

Enables or disables drop target support on a widget for files, URLs, and text.

When enabled, dropping files emits UiEvent::FilesDropped, dropping URLs emits UiEvent::UrlsDropped, and dropping plain text emits UiEvent::TextDropped. When dropped onto text widgets (such as WidgetKind::RichText or WidgetKind::TextArea), the drop event includes the character caret offset where the drop occurred.

Source

pub fn set_size( &mut self, widget_id: WidgetId, width: i32, height: i32, ) -> GuiResult<()>

Sets preferred dimensions for a widget.

The request is written into the widget’s layout style as well as the spec and the backend, mirroring Self::set_container_direction, so a later compute_layout pass honours it instead of rewriting it with the computed value (imperative and declarative authoring must produce the same result).

Source

pub fn set_flex_grow(&mut self, widget_id: WidgetId, grow: f32) -> GuiResult<()>

Sets how much of its parent container’s spare main-axis space a widget absorbs on each layout pass.

This is the imperative counterpart of the declarative crate::declarative::Node::flex_grow: 0.0 (the default) keeps the widget at its requested or natural size, while positive factors split the remaining space between growing siblings proportionally. A Self::set_size request becomes the widget’s basis, so a pinned pane still grows when its window is enlarged. The main axis is the parent’s ContainerDirection; layout roots registered with Self::set_layout_root apply the change on their next resize, and Self::compute_layout applies it immediately.

Source

pub fn flex_grow(&self, widget_id: WidgetId) -> GuiResult<f32>

Returns the flex-grow factor set by Self::set_flex_grow.

Source

pub fn set_min_size( &mut self, widget_id: WidgetId, width: i32, height: i32, ) -> GuiResult<()>

Sets the smallest size layout passes may give a widget.

Unlike Self::set_size, which pins both axes, a minimum leaves the widget free to stretch across its parent’s cross axis and, with Self::set_flex_grow, along the main axis - the usual way to keep a designed size for a pane while letting it fill a larger window. A 0 component leaves that axis unconstrained; (0, 0) clears the minimum. Applies on the next Self::compute_layout or layout-root resize.

The floor is recorded on the shared model and forwarded to the backend so lanes that own their automatic layout (Win32) honour it too, not just the shared pass.

Source

pub fn min_size(&self, widget_id: WidgetId) -> GuiResult<(i32, i32)>

Returns the minimum recorded by Self::set_min_size, (0, 0) when none is set.

Source

pub fn set_preferred_width( &mut self, widget_id: WidgetId, width: u32, ) -> GuiResult<()>

Sets a width-only constraint on a widget’s layout node, leaving its height unconstrained.

This allows panels and inspectors (such as in gui_photo_gallery) to fix their width without having to re-pin their height to match their container when the window resizes.

Source

pub fn preferred_width(&self, widget_id: WidgetId) -> GuiResult<Option<u32>>

Returns the preferred width set by Self::set_preferred_width, or None if not set.

Source

pub fn set_layout_style( &mut self, widget_id: WidgetId, style: Style, ) -> GuiResult<()>

Sets the layout style on a widget using Native GUI-owned layout types.

Validates all numeric constraints (finite numbers, non-negative factors and dimensions) before applying the style and schedules an incremental layout invalidation pass.

Source

pub fn layout_style(&self, widget_id: WidgetId) -> GuiResult<Style>

Returns the current layout style of a widget as an native-gui-owned crate::layout::Style.

Source

pub fn layout_rect(&self, widget_id: WidgetId) -> GuiResult<LayoutRect>

Returns the computed layout rectangle for a widget in parent-local coordinates.

Source

pub fn debug_layout(&self, root: WidgetId) -> GuiResult<String>

Renders the computed layout of root and its descendants as an indented text tree, one widget per line: id, kind, text, the parent-local rect from the last Self::compute_layout, and flags for hidden widgets, flex_grow, and app minimum sizes. A debugging aid for “why is this row zero pixels tall?” (found while dogfooding); the format is for humans and may change.

let window = ui.create(WidgetKind::Window, Some("Main"))?;
ui.compute_layout(window, 640.0, 480.0)?;
eprintln!("{}", ui.debug_layout(window)?);
Source

pub fn set_window_min_size( &mut self, widget_id: WidgetId, width: u32, height: u32, ) -> GuiResult<()>

Sets the minimum dimensions for a top-level window.

Returns GuiError::UnsupportedWidget if widget_id is not a window.

Source

pub fn window_min_size( &self, widget_id: WidgetId, ) -> GuiResult<Option<(u32, u32)>>

Returns the minimum size set on a window via Self::set_window_min_size, or derived from its layout root content minimum.

Source

pub fn explicit_window_min_size( &self, widget_id: WidgetId, ) -> GuiResult<Option<(u32, u32)>>

Returns only the explicit minimum size set on a window via Self::set_window_min_size.

Source

pub fn set_resizable( &mut self, widget_id: WidgetId, resizable: bool, ) -> GuiResult<()>

Sets whether a top-level window can be resized by the user.

Returns GuiError::UnsupportedWidget if widget_id is not a window.

Source

pub fn is_resizable(&self, widget_id: WidgetId) -> GuiResult<bool>

Returns whether a window is resizable. Defaults to true.

Source

pub fn resizable(&self, widget_id: WidgetId) -> GuiResult<bool>

Alias for Self::is_resizable.

Source

pub fn native_handle(&self, widget_id: WidgetId) -> GuiResult<B::NativeHandle>

Returns backend-native handle information for a Vulkan canvas widget.

Source

pub fn vulkan_canvas_handle( &self, widget_id: WidgetId, ) -> GuiResult<B::NativeHandle>

Returns backend-native handle information for a Vulkan canvas widget.

Source

pub fn metal_canvas_handle( &self, widget_id: WidgetId, ) -> GuiResult<MetalCanvasHandle>

Returns backend-native handle information for a Metal canvas widget.

Source

pub fn create_combo_box<S: AsRef<str>>( &mut self, items: &[S], ) -> GuiResult<WidgetId>

Creates a ComboBox with typed options (found while dogfooding), replacing the legacy create(WidgetKind::ComboBox, Some("A|B|C")) form (still accepted, but deprecated in the docs). Works on every lane. The first option is selected.

Source

pub fn set_items<S: AsRef<str>>( &mut self, widget_id: WidgetId, items: &[S], ) -> GuiResult<()>

Replaces the options of a choice widget from a slice (dogfood report #7). ComboBox goes through Backend::set_combo_box_items (supported across Mock, GTK, Win32, Cocoa, Web, and TUI when widgets-choice is enabled), keeping the selected index in Ui’s model when it is still in range and otherwise selecting the first option, silently. MultiSelect, DataList and ListView forward to Self::set_data_list_items.

Source

pub fn items(&self, widget_id: WidgetId) -> GuiResult<Vec<String>>

The options of a choice widget: a ComboBox/MultiSelect’s options (parsed from the creation text, or the last Self::set_items), or a DataList/ListView’s items.

Source

pub fn set_data_list_items( &mut self, widget_id: WidgetId, items: &[String], ) -> GuiResult<()>

Sets items for a data list widget.

Source

pub fn set_list_columns( &mut self, widget_id: WidgetId, columns: &[ColumnSpec], ) -> GuiResult<()>

Replaces the column headers of a columned list.

Validates the widget kind through the shared applicability table (ListView only), records the columns on the spec, and forwards to the backend. Passing an empty slice returns the widget to the shipped single-column row contract, where rows come from Self::set_data_list_items. A lane without a columned mapping reports the typed UnsupportedCapability("list_view_columns") refusal (native mappings are follow-ups).

Source

pub fn set_list_rows( &mut self, widget_id: WidgetId, rows: &[Vec<String>], ) -> GuiResult<()>

Replaces the row cells of a columned list.

Row r, cell c renders column c’s header with the text rows[r][c]; missing trailing cells render empty and cells beyond the column count are ignored. Shares the kind guard and the lane capability refusal with Self::set_list_columns.

Source

pub fn set_rows_keyed( &mut self, widget_id: WidgetId, rows: &[RowSet], ) -> GuiResult<RowDelta>

Applies a keyed row update to a row widget.

Identity is the application-owned RowKey: the submitted vector defines display order, cells replace verbatim, and the returned RowDelta classifies what changed. Equal keys, order, and cells are a free no-op (no backend call at all). Duplicate keys are rejected with GuiError::Backend("duplicate row key") before anything is touched, and a lane that cannot drop a removed selection reports the typed UnsupportedCapability("clear_selection") refusal, also before the rows change.

The selection follows the key the widget kept (recorded when Self::set_selected_index/Self::set_selected_indices ran on keyed rows): an index move writes the new index and emits one SelectionChanged carrying it; a removed key clears the selection and emits the clear through Self::clear_selection. The scroll anchor follows the same rule through the lane’s scroll_anchor capability; a lane that cannot report it is skipped rather than guessed.

Keyed bookkeeping tracks keyed applies; calling the plain population setters in between resets the baseline, so the next keyed apply reports everything it writes as inserted. TreeView keeps its flat indented-row contract for this cut.

Source

pub fn clear_selection(&mut self, widget_id: WidgetId) -> GuiResult<()>

Clears the selection of a row widget.

Clears the shared index and multi-selection state, drops the keyed selection, asks the backend to clear its native selection (the "clear_selection" capability; lanes without a mapping report the typed refusal), and emits one UiEvent::SelectionChanged { selected: None, index: None } when a selection was actually cleared, so observers never miss a silent reset. The backend is consulted before the shared model changes, so a refused call leaves the previous selection untouched.

Source

pub fn visible_anchor(&self, widget_id: WidgetId) -> GuiResult<Option<RowKey>>

Returns the application-owned key of a keyed row widget’s topmost visible row.

The backend reports the anchor row’s index through the "scroll_anchor" capability; a lane that cannot observe its scroll position returns the typed GuiError::UnsupportedCapability refusal, and a widget without keyed rows answers None.

Source

pub fn rows_end_visible(&self, widget_id: WidgetId) -> GuiResult<bool>

Reports whether the last row of a keyed row widget is currently visible (follow-tail detection).

Forwarded to the backend’s Backend::rows_end_visible capability (the same "scroll_anchor" family as Self::visible_anchor): a lane that cannot observe its scroll position reports the typed GuiError::UnsupportedCapability refusal, and a widget whose rows are all above the viewport answers false.

Source

pub fn scroll_to_row( &mut self, widget_id: WidgetId, index: usize, ) -> GuiResult<()>

Scrolls a row widget so index is the topmost visible row.

Forwarded to the backend’s Backend::scroll_to_row capability (the same "scroll_anchor" family as Self::visible_anchor). A lane that cannot move the viewport reports the typed GuiError::UnsupportedCapability refusal.

Source

pub fn selected_row_key(&self, widget_id: WidgetId) -> Option<RowKey>

Returns the keyed selection of a row widget, if any.

Populated when Self::set_selected_index/Self::set_selected_indices run on a widget with keyed rows, and kept in step by Self::set_rows_keyed and Self::clear_selection. For a multi-selection this reports the lowest-index surviving member.

Source

pub fn set_data_grid_rows( &mut self, widget_id: WidgetId, rows: &[Vec<String>], ) -> GuiResult<()>

Sets row-major cell values for a data grid widget.

Source

pub fn set_data_grid_columns( &mut self, widget_id: WidgetId, columns: &[ColumnSpec], ) -> GuiResult<()>

Declares a DataGrid’s columns separately from its data (dogfood report #6), so the header is no longer data row 0 by convention.

The header row is rendered natively as row 0 (on every lane), data rows set with Self::set_data_grid_data_rows follow it, and Self::data_grid_data_row maps the raw row of a SelectionChanged/GridCellClicked/Activated event back to a 0-based data index. Column widths are applied best-effort: lanes that report UnsupportedCapability for set_data_grid_col_width keep their default widths. Passing an empty slice removes the header.

Non-breaking: grids that never call this keep the raw Self::set_data_grid_rows behaviour.

Source

pub fn set_data_grid_data_rows( &mut self, widget_id: WidgetId, rows: &[Vec<String>], ) -> GuiResult<()>

Sets a DataGrid’s data rows (0-based), rendering the header from Self::set_data_grid_columns above them when columns are declared.

Source

pub fn data_grid_columns(&self, widget_id: WidgetId) -> &[ColumnSpec]

The declared columns of a DataGrid (empty when none).

Source

pub fn data_grid_data_row( &self, widget_id: WidgetId, raw_row: usize, ) -> Option<usize>

Maps a raw grid row (as reported by SelectionChanged, GridCellClicked, GridSelectionChanged or Activated) to a 0-based data row: None for the header row. Without declared columns the raw row is returned unchanged.

Source

pub fn select_data_grid_row( &mut self, widget_id: WidgetId, data_row: Option<usize>, ) -> GuiResult<()>

Highlights one whole data row (0-based; header-aware) or clears the highlight with None - the one-call form of building a (row, col) list for Self::set_data_grid_selection.

Source

pub fn set_data_grid_model( &mut self, widget_id: WidgetId, model: Box<dyn DataGridModel>, ) -> GuiResult<()>

Sets a virtual data model for a data grid widget.

Source

pub fn set_data_grid_row_height( &mut self, widget_id: WidgetId, row: usize, height: i32, ) -> GuiResult<()>

Sets the height of a specific row in a data grid widget.

Source

pub fn set_data_grid_col_width( &mut self, widget_id: WidgetId, col: usize, width: i32, ) -> GuiResult<()>

Sets the width of a specific column in a data grid widget.

Source

pub fn set_data_grid_frozen_panes( &mut self, widget_id: WidgetId, rows: usize, cols: usize, ) -> GuiResult<()>

Sets the number of frozen rows and columns in a data grid widget.

Source

pub fn set_data_grid_selection( &mut self, widget_id: WidgetId, selection: &[(usize, usize)], ) -> GuiResult<()>

Source

pub fn set_tree_items( &mut self, widget_id: WidgetId, items: &[TreeItem], ) -> GuiResult<()>

Sets hierarchical items for a tree view widget.

Source

pub fn set_canvas_scene( &mut self, widget_id: WidgetId, scene: &CanvasScene, ) -> GuiResult<()>

Sets the current scene for a canvas widget.

Source

pub fn set_canvas_surface( &mut self, widget_id: WidgetId, surface: &CanvasSurface, ) -> GuiResult<()>

Sets the raster surface painted beneath a canvas widget’s scene.

The surface is clipped to the widget and composited over the canvas background, so transparent pixels display as the background while the stored buffer keeps its alpha. Replacing the surface repaints it immediately; full typed image resources remain the scope.

Source

pub fn copy_to_clipboard(&mut self, widget_id: WidgetId) -> GuiResult<()>

Copies a widget’s content into the shared clipboard.

Supported kinds: DataList/ListView (rows joined with newlines), DataGrid (rows serialized), and text widgets (TextInput, TextArea, Label). The text is mirrored in the Ui and forwarded to the backend’s platform clipboard where supported (GTK today; Win32 tracked).

Source

pub fn paste_from_clipboard(&mut self, widget_id: WidgetId) -> GuiResult<()>

Pastes the shared clipboard into a widget.

Supported kinds: DataList/ListView, DataGrid, and text widgets (TextInput, TextArea, Label — a label’s text is replaced). Prefers the backend’s platform clipboard (GTK reads the OS clipboard); falls back to the in-memory Ui mirror.

Source

pub fn paste_image_from_clipboard( &mut self, ) -> GuiResult<Option<ClipboardImage>>

Pastes an image from the platform clipboard, returning raw RGBA pixels and encoded PNG bytes.

Source

pub fn set_position( &mut self, widget_id: WidgetId, x: i32, y: i32, ) -> GuiResult<()>

Sets preferred position for a widget.

Source

pub fn set_background_color( &mut self, widget_id: WidgetId, color: Color, ) -> GuiResult<()>

Sets background color for a widget.

Source

pub fn set_alert_level( &mut self, widget_id: WidgetId, level: AlertLevel, ) -> GuiResult<()>

Sets alert severity for an alert dialog widget.

Source

pub fn set_image_source( &mut self, widget_id: WidgetId, source: &str, ) -> GuiResult<()>

Sets image source for an image widget.

Source

pub fn image_resource_capabilities(&self) -> ImageResourceCapabilities

Reports bounded in-memory RGBA image-resource support on this backend.

Source

pub fn load_image_resource( &mut self, data: &ImageData, ) -> GuiResult<ImageResourceId>

Loads validated RGBA8 pixels as a resource owned by this Ui.

Image dimensions must be positive, the buffer must contain exactly four bytes per pixel, each image is limited to 64 MiB, and all live images together are limited to 256 MiB. Encoded formats and filesystem paths are not accepted.

Source

pub fn image_resource_is_live(&self, resource: ImageResourceId) -> bool

Returns whether resource is still live in this UI’s registry.

Source

pub fn release_image_resource( &mut self, resource: ImageResourceId, ) -> GuiResult<()>

Releases a live image resource from its backend and this UI.

Unknown and already-released identifiers return a deterministic backend error. A refused backend release leaves the UI registry intact.

Source

pub fn set_image_fit( &mut self, widget_id: WidgetId, fit: ImageFit, ) -> GuiResult<()>

Sets how an image scales into its bounds.

Validates the widget kind, records the mode on the shared spec, then forwards to the backend so unsupported lanes report a typed error.

Source

pub fn set_file_chooser_mode( &mut self, widget_id: WidgetId, mode: FileChooserMode, ) -> GuiResult<()>

Sets what a FileChooserDialog lets the user pick.

Validates the widget kind, records the mode on the shared spec, then forwards to the backend so an unsupported picker reports a typed error instead of showing the wrong dialog.

Source

pub fn set_icon( &mut self, widget_id: WidgetId, icon: Option<IconRole>, ) -> GuiResult<()>

Sets the stock-art icon rendered beside a button’s label.

Validates the widget kind (Button and FileChooserDialog), records the role on the shared spec, then forwards to the backend, which resolves it through the portable art provider for the active theme; None clears the icon. Lanes that cannot render button art report the typed unsupported error instead of silently dropping the call.

Source

pub fn set_color_dialog_data( &mut self, widget_id: WidgetId, data: ColorDialogData, ) -> GuiResult<()>

Sets the preferences of a colour-dialog widget.

Validates the widget kind, applies the shared data rules (the crate::MAX_CUSTOM_COLORS palette cap), records the data on the shared spec, and forwards to the backend. Native lanes without a mapping for the chooser report the typed unsupported error from the backend default, so a caller never believes the preferences applied.

Source

pub fn set_font_dialog_data( &mut self, widget_id: WidgetId, data: FontDialogData, ) -> GuiResult<()>

Sets the preferences of a font-dialog widget.

Validates the widget kind and the shared data rules (finite, non-inverted size range), records the data on the shared spec, and forwards to the backend. Native lanes without a mapping for the chooser report the typed unsupported error from the backend default.

Source

pub fn set_toolbar_items( &mut self, widget_id: WidgetId, items: Vec<ToolbarItem>, ) -> GuiResult<()>

Replaces the rows of a toolbar widget.

Validates the widget kind and the shared model rules (unique tool ids, radio groups anchored on a checkable owner) before anything is recorded, so a rejected list leaves the previous rows untouched. The accepted list is stored on the shared spec and forwarded to the backend; lanes without a native toolbar report the typed unsupported error (composes them).

Source

pub fn set_toolbar_orientation( &mut self, widget_id: WidgetId, orientation: ToolbarOrientation, ) -> GuiResult<()>

Sets the stacking orientation of a toolbar widget.

Source

pub fn set_tool_state( &mut self, widget_id: WidgetId, tool_id: ToolId, checked: bool, ) -> GuiResult<Vec<(ToolId, bool)>>

Applies a programmatic checked-state change to a toolbar tool.

Radio exclusivity is enforced by the shared rules: checking a member unchecks the other members of its group. This is the programmatic path, so it never emits ToolToggled/ToolActivated events — the tools whose state actually changed are returned in toolbar order (empty for a no-op), which is what an application mirrors into its own model. Non-checkable tools report the typed model error.

Source

pub fn update_tool( &mut self, widget_id: WidgetId, tool_id: ToolId, update: ToolUpdate, ) -> GuiResult<()>

Patches one toolbar tool in place: label, tooltip, icon, display mode, enabled/visible state, and the dropdown flag.

checked is deliberately not part of ToolUpdate; use Ui::set_tool_state so radio exclusivity and the silent-programmatic rule apply. The patched list is forwarded to the backend like Ui::set_toolbar_items.

Source

pub fn set_calendar_selected_dates( &mut self, widget_id: WidgetId, dates: &[CalendarDate], ) -> GuiResult<()>

Sets the selected dates of a calendar widget.

Source

pub fn set_calendar_bounds( &mut self, widget_id: WidgetId, min_date: Option<CalendarDate>, max_date: Option<CalendarDate>, ) -> GuiResult<()>

Sets selectable date bounds for a calendar widget.

Source

pub fn set_calendar_first_day_of_week( &mut self, widget_id: WidgetId, first_day: CalendarFirstDayOfWeek, ) -> GuiResult<()>

Sets the first day of the week convention for a calendar widget.

Source

pub fn set_calendar_selection_mode( &mut self, widget_id: WidgetId, mode: CalendarSelectionMode, ) -> GuiResult<()>

Sets the selection mode for a calendar widget.

Source

pub fn set_date_value( &mut self, widget_id: WidgetId, iso_date: &str, ) -> GuiResult<()>

Sets date value (YYYY-MM-DD) for a date picker widget.

Sets URL for a link label widget.

Source

pub fn set_container_direction( &mut self, widget_id: WidgetId, direction: ContainerDirection, ) -> GuiResult<()>

Sets stacking direction for a container widget.

Source

pub fn set_container_wrap( &mut self, widget_id: WidgetId, wrap: ContainerWrap, ) -> GuiResult<()>

Sets wrap behavior for a container widget (Container, GroupBox, SplitPane).

Source

pub fn create_flow_container( &mut self, parent: Option<WidgetId>, gap: i32, ) -> GuiResult<WidgetId>

Creates a flow container with horizontal direction, wrapping enabled, and the specified uniform gap between children (Container).

Source

pub fn set_container_gap( &mut self, widget_id: WidgetId, gap: i32, ) -> GuiResult<()>

Sets the uniform spacing between a flow container’s children, in logical pixels (Container, GroupBox). Negative values clamp to 0.

The shared model keeps the layout tree in sync (both axes) so compute_layout and the native auto-layout agree, mirroring Ui::set_container_direction. Lanes that position children through the computed layout honour this directly; lanes with native boxes map it to their own spacing (GTK box spacing).

Source

pub fn set_container_padding( &mut self, widget_id: WidgetId, padding: i32, ) -> GuiResult<()>

Sets the uniform inset between a flow container’s edges and its flow children, in logical pixels (Container, GroupBox). Negative values clamp to 0.

Source

pub fn set_container_scroll( &mut self, widget_id: WidgetId, vertical: bool, horizontal: bool, ) -> GuiResult<()>

Sets scroll configuration for a container widget.

Source

pub fn draw_demo_cube(&mut self, widget_id: WidgetId) -> GuiResult<()>

Draws the built-in colored cube demo into a WidgetKind::VulkanCanvas.

Source

pub fn compute_layout( &mut self, root_id: WidgetId, width: f32, height: f32, ) -> GuiResult<()>

Computes and applies layout for root_id.

The pass is bounded by the strict topological dirty flags maintained by invalidate_layout: only the scheduled branches are re-seeded, clean branches keep their layout caches and are never re-measured, and native geometry is written only for widgets whose computed values changed. An unchanged pass performs no measurements and no writes while still applying any layout the tree reports as changed.

Source

pub fn attach(&mut self, parent: WidgetId, child: WidgetId) -> GuiResult<()>

Attaches child beneath parent in the UI tree.

§Contract (Pre / Post / Inv)
  • Pre: both ids are live and attaching does not close a parent cycle (self-parentage counts as a one-node cycle).
  • Post: child’s parent pointer is parent and the backend mirror was asked to attach the same pair. On any error the shared model is untouched, so a refused call never leaves a partial edge.
  • Inv: parent links stay acyclic. Ui::remove cascades and focus_chain_enabled walks rely on this to terminate. Depth is bounded by the layout engine (MAX_LAYOUT_DEPTH = 128). Attaching a leaf child short-circuits cycle validation in O(1); attaching an internal subtree walks ancestors in O(depth).
Source

pub fn reparent( &mut self, child: WidgetId, new_parent: WidgetId, ) -> GuiResult<()>

Reparents an existing child to a new parent.

Refuses self-reparenting and any move that would close a parent cycle; a refused call leaves the previous parent edge in place.

Source

pub fn widget_depth(&self, widget_id: WidgetId) -> usize

Returns the tree depth of widget_id (0 for root with no parent, 1 for child of root, etc.).

Source

pub fn widget_subtree_height(&self, widget_id: WidgetId) -> usize

Returns the height of the subtree rooted at widget_id (1 for a leaf, 1 + max(child heights)).

Source

pub fn show(&mut self, widget_id: WidgetId) -> GuiResult<()>

Shows a widget, typically a top-level window.

Source

pub fn hide(&mut self, widget_id: WidgetId) -> GuiResult<()>

Hides a widget without removing it from the tree.

Source

pub fn set_visible( &mut self, widget_id: WidgetId, visible: bool, ) -> GuiResult<()>

Sets whether a widget is visible or hidden.

Hidden widgets are given display: Display::None in the layout tree so they do not occupy layout space during compute_layout.

Source

pub fn is_visible(&self, widget_id: WidgetId) -> bool

Whether the widget is currently visible (not hidden via Self::hide).

Source

pub fn is_effectively_hidden(&self, widget_id: WidgetId) -> bool

Whether the widget is effectively hidden, either directly via Self::hide or by having an ancestor that is hidden.

Source

pub fn capture_window_rgba( &self, window_id: WidgetId, include_decorations: bool, ) -> GuiResult<(u32, u32, Vec<u8>)>

Captures a screenshot of the specified window as top-down RGBA pixels.

Validates that window_id exists and is a WidgetKind::Window, then forwards to the backend implementation.

Source

pub fn capture_widget_rgba( &self, widget_id: WidgetId, ) -> GuiResult<(u32, u32, Vec<u8>)>

Captures a screenshot of the specified widget as top-down RGBA pixels.

Validates that widget_id exists, then forwards to the backend implementation.

Source

pub fn native_read_text(&self, widget_id: WidgetId) -> GuiResult<Option<String>>

Reads live text for a widget (E2E readback).

Validates widget_id, attempts live backend readback, and gracefully falls back to the cached spec.text if the backend returns Ok(None).

Source

pub fn native_read_checked( &self, widget_id: WidgetId, ) -> GuiResult<Option<bool>>

Reads live checked state for a checkbox/radio widget (E2E readback).

Validates widget_id, attempts live backend readback, and gracefully falls back to the cached spec.checked if the backend returns Ok(None).

Source

pub fn native_click(&self, widget_id: WidgetId) -> GuiResult<bool>

Simulates a native click on an actionable widget (E2E action).

Validates widget_id and forwards to the backend implementation.

Source

pub fn native_type_text( &mut self, widget_id: WidgetId, text: &str, ) -> GuiResult<bool>

Simulates native text input on an editable widget (E2E action).

Validates widget_id and forwards to the backend implementation.

Source

pub fn remove(&mut self, widget_id: WidgetId) -> GuiResult<()>

Removes a widget (and, recursively, its descendants) from the UI tree.

The child walk follows the adjacency index (children_index), so tearing down a subtree of size N visits each parent-child edge exactly once: O(N) in the subtree size, independent of the total widget count. Descendants are still removed first so no child outlives its parent, and index edges are only released after a removal has actually succeeded, so a backend refusal leaves the surviving edges intact for a retry.

Source

pub fn set_enabled( &mut self, widget_id: WidgetId, enabled: bool, ) -> GuiResult<()>

Enables or disables a widget.

Source

pub fn activate(&mut self, widget_id: WidgetId) -> GuiResult<()>

Programmatically activates a clickable widget (button, file chooser, link label) exactly as if the user clicked it.

Source

pub fn app_data_dir(&self) -> GuiResult<PathBuf>

Returns the platform-specific application data directory (XDG data home on Linux, %APPDATA% on Windows, the temp directory on the Mock backend). Apps should persist their state under a subdirectory of this path instead of the current working directory.

Source

pub fn set_tooltip(&mut self, widget_id: WidgetId, text: &str) -> GuiResult<()>

Sets tooltip text for a widget.

Source

pub fn set_accessible_name( &mut self, widget_id: WidgetId, name: &str, ) -> GuiResult<()>

Sets the accessible name announced by assistive technology.

Updates the shared spec and forwards to the backend; a backend whose native accessibility bridge has not landed returns GuiError::UnsupportedCapability instead of silently ignoring the request.

Source

pub fn set_accessible_description( &mut self, widget_id: WidgetId, description: &str, ) -> GuiResult<()>

Sets the accessible description announced after the name.

Source

pub fn accessibility(&self, widget_id: WidgetId) -> Option<&AccessibilitySpec>

Returns the accessibility metadata of a widget, when it exists.

Source

pub fn set_focusable( &mut self, widget_id: WidgetId, focusable: bool, ) -> GuiResult<()>

Marks a widget as focusable (or not) for tab traversal.

Source

pub fn is_focusable(&self, widget_id: WidgetId) -> Option<bool>

Returns whether a widget is focusable, respecting per-kind defaults.

Source

pub fn focus(&mut self, widget_id: WidgetId) -> GuiResult<()>

Moves keyboard focus to a widget.

Any existing widget can receive programmatic focus; traversal (Self::focus_next, Self::focus_previous) visits focusable, enabled widgets only. The previous focus is reported as UiEvent::FocusChanged { focused: false } by backends that can report focus (Mock and Win32 report every programmatic change; GTK and Cocoa emit the focus-in/out transitions they observe).

Source

pub fn focused(&self) -> Option<WidgetId>

Returns the widget that currently holds keyboard focus, when known.

Source

pub fn focus_order(&self) -> Vec<WidgetId>

Focus candidates in tab order: focusable widgets whose own and ancestors’ enabled flags allow input, in creation order (which is also WidgetId order).

Source

pub fn spatial_focus_order(&self) -> Vec<WidgetId>

Returns focus candidates in 2D spatial reading order (top-to-bottom, left-to-right).

Unlike Self::focus_order, which returns candidates in monotonic WidgetId creation order, spatial_focus_order queries layout coordinates and partitions widgets into visual row bands (using vertical tolerance threshold), sorting primary by row band and secondary by horizontal offset x.

This ensures accessible Tab navigation strictly conforms to WCAG 2.1 reading order in auto-wrapping flex containers (ContainerWrap::Wrap) and multi-row forms.

Source

pub fn focus_next(&mut self) -> GuiResult<Option<WidgetId>>

Moves focus to the next focus candidate, wrapping at the end.

Returns the newly focused widget, or None when nothing is focusable.

Source

pub fn focus_previous(&mut self) -> GuiResult<Option<WidgetId>>

Moves focus to the previous focus candidate, wrapping at the start.

Source

pub fn set_theme(&mut self, theme: Theme) -> GuiResult<()>

Replaces the active theme.

Switches to the given theme.

The resolved theme is stored on the Ui record only after the backend accepts it; on failure the previous theme is preserved.

Source

pub fn set_theme_mode(&mut self, mode: ThemeMode) -> GuiResult<()>

Switches to the built-in light or dark theme.

Source

pub fn theme(&self) -> &Theme

Returns the active theme.

Source

pub fn theme_mode(&self) -> ThemeMode

Returns the active theme mode.

Source

pub fn theme_capabilities(&self) -> ThemeCapabilities

Returns the backend’s system theme detection capabilities.

Source

pub fn gpu_surface_capabilities(&self) -> GpuSurfaceCapabilities

Reports the active backend’s GPU host-surface capabilities.

Source

pub fn supports_capability(&self, capability: &str) -> bool

Tests a standard GPU-surface capability identifier. Unknown identifiers return false.

Source

pub fn set_gpu_degradation_policy(&mut self, policy: GpuDegradationPolicy)

Selects the policy for future Vulkan canvas creations whose backend does not advertise a Vulkan surface.

Source

pub fn is_gpu_degraded(&self, widget_id: WidgetId) -> bool

Returns whether widget_id was created through a GPU degradation path. Unknown ids and native Vulkan canvases return false.

Source

pub fn display_capabilities(&self) -> DisplayCapabilities

Returns the backend’s display-metric capabilities.

Source

pub fn displays(&self) -> GuiResult<Vec<DisplayInfo>>

Enumerates the connected displays.

On lanes that cannot enumerate this returns the typed GuiError::UnsupportedCapability; check Ui::display_capabilities first when the app has a fallback path. DPI/monitor transitions arrive as UiEvent::DisplayChanged.

Source

pub fn primary_display(&self) -> GuiResult<Option<DisplayInfo>>

Returns the primary display, or None when enumeration succeeds but reports no primary.

Source

pub fn logical_pointer_projection( &self, widget_id: WidgetId, x: f32, y: f32, ) -> (f32, f32)

Projects a pointer coordinate from the display’s native pixel space into logical (96-DPI) coordinates for widget_id.

Ui already applies this to every UiEvent::PointerDown, UiEvent::PointerMove, and UiEvent::PointerUp it dispatches, so app code never needs to call it for event coordinates: they arrive in the logical space this returns. It stays public for the other sources of a raw position — a drag payload, a native handle, a scripted physical coordinate — where the scaling still has to be inverted explicitly to line the value up with layout targets.

It resolves the widget’s display scale through Backend::widget_scale_factor and inverts the OS scaling matrix via crate::logical_pointer_projection. On lanes that report a scale of 1.0 (GTK4, Cocoa, Mock without a scaled display fixture) the projection is the identity; on a 125 % Win32 display a physical (125, 250) maps to logical (100, 200).

Source

pub fn system_theme_mode(&self) -> Option<ThemeMode>

Returns the OS light/dark preference when the backend can detect it.

Source

pub fn system_high_contrast(&self) -> bool

Returns whether the OS high-contrast accessibility mode is active.

Source

pub fn stock_icon(&self, role: IconRole, size: IconSize) -> StockIcon

Resolves a portable stock icon at the 96 dpi baseline.

The icon’s palette follows the active theme (light/dark), so callers re-resolve after Ui::set_theme_mode; see Ui::stock_icon_at_scale for DPI variants.

Source

pub fn stock_icon_at_scale( &self, role: IconRole, size: IconSize, scale: u32, ) -> StockIcon

Resolves a portable stock icon at an explicit DPI scale factor.

scale models the display density (1 = 96 dpi, 2 = 200 %, …) and is clamped to 1..=4; the raster edge is size.pixels() * scale.

Every call re-rasterizes the glyph (there is no cache), so resolve an icon once and reuse the returned value when drawing it repeatedly.

Source

pub fn native_stock_icon( &self, role: IconRole, size: IconSize, ) -> GuiResult<StockIcon>

Resolves an OS-native stock icon when the lane provides one.

Lanes without a native mapping return the typed GuiError::UnsupportedCapability; portable art is always available through Ui::stock_icon.

Source

pub fn art_capabilities(&self) -> ArtCapabilities

Returns the lane’s native stock-art capabilities.

Source

pub fn set_theme_override( &mut self, widget_id: WidgetId, theme_override: ThemeOverride, ) -> GuiResult<()>

Adds a theme override for one widget.

The override is stored on the Ui record only after the backend accepts it, so a refusing backend never leaves a phantom override.

Source

pub fn theme_overrides(&self, widget_id: WidgetId) -> &[ThemeOverride]

Returns the theme overrides registered for a widget.

Source

pub fn clear_theme_overrides(&mut self, widget_id: WidgetId) -> GuiResult<()>

Clears all theme overrides for a widget.

Source

pub fn task_proxy(&mut self) -> UiProxy

Returns a cloneable handle for posting commands from worker threads.

The first call creates one bounded command channel for this Ui (capacity DEFAULT_TASK_QUEUE_CAPACITY) wired to the backend’s wake hook; later calls return clones of the same handle. See the crate::async_ui module docs for the worker/UI-thread contract.

Source

pub fn shutdown(self) -> usize

Tears the Ui down explicitly and returns how many queued background-task commands were discarded unapplied.

Dropping a Ui (or Ui::into_backend) has the same effect — Ui deliberately has no Drop impl so into_backend can move the backend out; the channel receiver drops with it (see the drop contract in crate::async_ui): the command channel closes, every UiProxy clone then reports crate::TaskSendError::Closed, and commands still queued are discarded without being applied. Call shutdown after the final Ui::drain_task_commands when you need to know whether any worker commit was lost.

Source

pub fn drain_task_commands(&mut self) -> TaskDrainReport

Applies queued background-task commands in FIFO order.

Widget commands go through the same set_* paths as direct calls, so shared specs and native widgets stay in sync; a command for a removed widget is rejected instead of panicking and emits a TaskEvent::Aborted dead-letter notification, so a teardown race can never swallow a worker’s commit silently. Lifecycle commands queue UiEvent::Task notifications for the next wait_event / poll_event call. The event functions call this automatically; call it directly before screenshots or assertions.

Source

pub fn drain_task_callbacks(&mut self)

Drains and invokes any pending typed task completion callbacks.

Source

pub fn try_spawn_task_with_callback<T, W, C>( &mut self, worker: W, callback: C, ) -> GuiResult<TaskHandle>
where T: Send + 'static, W: FnOnce(TaskToken) -> T + Send + 'static, C: FnOnce(&mut Ui<B>, T) -> GuiResult<()> + 'static,

Spawns a background worker thread and delivers its typed return value to callback on the UI thread when complete.

This pattern mimics Tauri’s invoke(), eliminating manual TaskId maps and custom task events. If the task is cancelled via crate::async_ui::TaskHandle::cancel, the completion callback is skipped. Attempts to spawn a background worker thread and deliver its typed return value to callback on the UI thread when complete.

If thread creation fails (e.g. OS thread resource exhaustion), returns GuiError::ResourceExhausted and cleans up task bookkeeping.

If worker panics, the panic is caught and isolated: callback is safely dropped without executing, the TaskHandle is marked finished, and UiEvent::Task(TaskEvent::Failed) is dispatched on the UI thread, preventing permanent callback or memory leaks.

Source

pub fn spawn_task_with_callback<T, W, C>( &mut self, worker: W, callback: C, ) -> TaskHandle
where T: Send + 'static, W: FnOnce(TaskToken) -> T + Send + 'static, C: FnOnce(&mut Ui<B>, T) -> GuiResult<()> + 'static,

Spawns a background worker thread and delivers its typed return value to callback on the UI thread when complete.

This pattern mimics Tauri’s invoke(), eliminating manual TaskId maps and custom task events. If the task is cancelled via crate::async_ui::TaskHandle::cancel, the completion callback is skipped.

If the worker panics, the panic is caught and isolated: the callback is dropped without executing, the handle is marked finished, and a TaskEvent::Failed is dispatched.

Source

pub fn wait_event(&mut self) -> GuiResult<UiEvent>

Blocks until the next UI event arrives, without busy-looping.

Queued background-task commands are applied first (FIFO); their lifecycle notifications are returned before backend events whenever both are ready. The internal TasksPending wake marker is consumed here and never surfaces to application code.

Source

pub fn poll_event(&mut self) -> GuiResult<Option<UiEvent>>

Polls one event, applying queued background-task commands first.

Returns None when neither task notifications nor backend events are pending. The internal TasksPending wake marker is consumed here.

Source

pub fn dispatch_events<F>(&mut self, handler: F) -> GuiResult<usize>
where F: FnMut(UiEvent),

Drains queued events, running registered callbacks and invoking handler.

Returns the number of dispatched events.

Source

pub fn dispatch_events_with<F>(&mut self, handler: F) -> GuiResult<usize>
where F: FnMut(&mut Ui<B>, UiEvent) -> GuiResult<LoopFlow>,

Drains queued events, running registered callbacks and invoking handler with &mut Ui so it can mutate widgets inline.

Returns the number of dispatched events. Each event gets the same pre-handler treatment as Self::dispatch_events — layout-root recompute, focus bookkeeping, then the callbacks registered through Ui::on_* — and only then handler runs. Returning LoopFlow::Exit stops the drain early; events produced by the handler are queued, never dropped, and are delivered in the same drain (see Self::run_until_closed_with for the ordering and reentrancy rules).

Source

pub fn run_until_closed<F>(&mut self, handler: F) -> GuiResult<()>
where F: FnMut(UiEvent),

Runs the application event loop until a WindowClosed event arrives.

Blocks efficiently (no 16 ms sleep loop): wait_event parks the backend until an event is ready. Each event gets the same treatment as in Self::dispatch_events — layout-root recompute, registered callbacks, then handler.

Source

pub fn run_until_closed_with<F>(&mut self, handler: F) -> GuiResult<()>
where F: FnMut(&mut Ui<B>, UiEvent) -> GuiResult<LoopFlow>,

Runs the application event loop until a WindowClosed event arrives, handing handler both the UI and the event so it can mutate widgets inline.

Blocks efficiently (no poll loop): wait_event parks the backend until an event is ready. Each event gets the same pre-handler treatment as Self::dispatch_events — layout-root recompute, focus bookkeeping, then the callbacks registered through Ui::on_* — and only then handler runs with &mut Ui. Returning LoopFlow::Exit stops the loop early; WindowClosed always stops it after the handler has seen the event.

§Reentrancy and ordering
  • A handler may call any Ui API; re-entering this runner or Self::dispatch_events_with is prevented at compile time by the &mut Ui borrow.
  • Registered callbacks run before the handler for the same event, exactly like Self::dispatch_events.
  • Events produced by a handler (for example Ui::activate on the Mock backend) are queued, never dropped, and are delivered on subsequent iterations; a handler that unconditionally produces events keeps the loop busy, so guards belong in app code.
Source

pub fn run_bounded<F>( &mut self, budget: Option<Duration>, handler: F, ) -> GuiResult<RunStop>
where F: FnMut(UiEvent),

Runs the application event loop until it closes, with an optional autoclose budget.

budget == None is exactly Self::run_until_closed: the loop parks in wait_event with no polling and returns once a UiEvent::WindowClosed arrives. With Some(budget) the loop polls (Self::poll_event plus a crate::autoclose::BOUNDED_POLL_INTERVAL sleep) and returns as soon as one of three things happens: the window closed, the handler answered LoopFlow::Exit, or the budget elapsed — see RunStop for which.

This is the library half of the NATIVE_GUI_<APP>_AUTOCLOSE_MS contract the example-level hook established: an unattended capture run must end by itself, because the runner’s TERM can only ever be reported as a hang. The budget itself is resolved by crate::autoclose::from_env, which the native-gui facade’s app::run calls for you.

§Ordering

The same pre-handler treatment as Self::dispatch_events applies (layout-root recompute, focus bookkeeping, then the callbacks registered through Ui::on_*), and events produced by the handler are queued rather than dropped — except that a stop leaves anything still queued undelivered, exactly like Self::run_until_closed.

Source

pub fn run_bounded_with<F>( &mut self, budget: Option<Duration>, handler: F, ) -> GuiResult<RunStop>
where F: FnMut(&mut Ui<B>, UiEvent) -> GuiResult<LoopFlow>,

Self::run_until_closed_with, bounded by an optional autoclose budget.

Drop-in for the &mut Ui runner: without a budget it forwards to Self::run_until_closed_with unchanged, so the blocking, callback-first semantics stay the library’s. With a budget it drives the public Self::dispatch_events_with pump and stops on the first of a UiEvent::WindowClosed, a LoopFlow::Exit from the handler, or the elapsed budget, reporting which through RunStop.

Source

pub fn run_routed<M, F>( &mut self, routes: &Routes<M>, handler: F, ) -> GuiResult<()>
where M: Clone + 'static, F: FnMut(&mut Ui<B>, M) -> GuiResult<LoopFlow>,

Runs the application event loop with typed message routing.

Each event is translated through routes (ignore-by-default); when a route matches, handler receives the typed message with &mut Ui. Registered Ui::on_* callbacks still run first, exactly like Self::run_until_closed_with. The loop ends after the handler sees a WindowClosed event, or early when the handler returns LoopFlow::Exit.

Source

pub fn dispatch_routed<M, F>( &mut self, routes: &Routes<M>, handler: F, ) -> GuiResult<usize>
where M: Clone + 'static, F: FnMut(&mut Ui<B>, M) -> GuiResult<LoopFlow>,

Drains queued events with typed message routing.

Like Self::dispatch_events_with, but each event is translated through routes first. Returns the number of dispatched events (routed or ignored).

Source

pub fn pre_dispatch(&mut self, event: &UiEvent)

Work shared by every dispatch path: layout recompute for layout roots, focus bookkeeping, and registered callbacks.

Source

pub fn observe_event(&mut self, event: &UiEvent)

Observes an event for the UI’s internal bookkeeping.

Source

pub fn text(&self, widget_id: WidgetId) -> GuiResult<&str>

The live text of a widget: the user’s latest edit for text controls (mirrored from TextChanged/TextSubmitted during dispatch), else the last value written with Self::set_text or at creation.

Returns "" for a widget that never had text.

Source

pub fn is_checked(&self, widget_id: WidgetId) -> GuiResult<bool>

The live checked state of a check-capable widget (Checkbox, RadioButton, …), kept in sync with user Toggled events.

Returns false when the state was never set or reported.

Source

pub fn selected_index(&self, widget_id: WidgetId) -> GuiResult<Option<usize>>

The live selected index of a selection widget (ComboBox, ListView, DataList, Tabs, …), kept in sync with user SelectionChanged events. None means nothing is selected.

Source

pub fn selected_indices(&self, widget_id: WidgetId) -> GuiResult<&[usize]>

The live selected indices of a multi-selection widget, kept in sync with user MultiSelectionChanged events.

Source

pub fn value(&self, widget_id: WidgetId) -> GuiResult<Option<i32>>

The live numeric value of a range widget (Slider, SpinBox, ProgressBar), kept in sync with user ValueChanged events.

Source

pub fn date_value(&self, widget_id: WidgetId) -> GuiResult<Option<&str>>

The live ISO date of a date widget, kept in sync with user DateChanged events.

Source

pub fn on_window_close<F>( &mut self, window_id: WidgetId, callback: F, ) -> GuiResult<()>
where F: FnMut() + 'static,

Registers a callback triggered when the given window closes.

Source

pub fn on_window_resize<F>( &mut self, window_id: WidgetId, callback: F, ) -> GuiResult<()>
where F: FnMut(i32, i32) + 'static,

Registers a callback triggered when the given window is resized.

Source

pub fn set_layout_root(&mut self, window_id: WidgetId) -> GuiResult<()>

Registers a window whose declarative layout is kept in sync with the native window automatically.

Whenever dispatch_events sees a UiEvent::WindowResized for window_id, compute_layout runs with the new dimensions before user handlers. App code no longer needs manual resize plumbing to keep computed layouts correct.

Multiple windows can be registered simultaneously. Calling set_layout_root adds window_id to the registered layout roots.

Source

pub fn add_layout_root(&mut self, window_id: WidgetId) -> GuiResult<()>

Adds a window to the set of registered layout roots.

Secondary windows and dialogs can be added so they also automatically recompute layout on resize without clobbering other windows.

Source

pub fn has_dirty_layout(&self) -> bool

Returns whether any layout roots have pending layout invalidations.

Source

pub fn is_layout_dirty(&self, widget_id: WidgetId) -> bool

Returns whether widget_id is in the pending layout invalidation schedule.

Source

pub fn flush_layout_roots(&mut self)

Re-runs layout for every layout root that has pending invalidations.

Called before each event poll/wait, so widgets shown, hidden, re-sized or re-attached since the last pass - inside a handler or after dispatch_events returned - are laid out at the root’s last known size instead of waiting for the next window resize. Free when nothing is scheduled; roots that were never laid out are skipped.

Source

pub fn compute_layout_if_dirty(&mut self)

Synchronously runs a layout pass on any layout roots with pending invalidations.

Equivalent to Self::flush_layout_roots.

Source

pub fn remove_layout_root(&mut self, window_id: WidgetId) -> bool

Removes a window from the set of registered layout roots. Returns true if the window was registered.

Source

pub fn is_layout_root(&self, window_id: WidgetId) -> bool

Returns true if the given window is currently a registered layout root.

Source

pub fn layout_roots(&self) -> &HashSet<WidgetId>

Returns the set of currently registered layout roots.

Source

pub fn on_menu_item_selected<F>( &mut self, item_id: MenuItemId, callback: F, ) -> GuiResult<()>
where F: FnMut() + 'static,

Registers a callback triggered when a menu item is selected.

Source

pub fn widget(&self, widget_id: WidgetId) -> Option<&WidgetSpec>

Returns a widget specification by identifier.

Source

pub fn widget_count(&self) -> usize

Returns the number of known widgets.

Trait Implementations§

Source§

impl<B: Backend> DeclarativeUi for Ui<B>

Source§

fn render<'a>(&mut self, node: &mut Node<'a>) -> GuiResult<WidgetId>

Renders a declarative Node tree into the Ui engine, creating and attaching widgets, applying styles, and forwarding explicit window dimensions and container spacing/padding to native backend properties.

Auto Trait Implementations§

§

impl<B> !RefUnwindSafe for Ui<B>

§

impl<B> !Send for Ui<B>

§

impl<B> !Sync for Ui<B>

§

impl<B> !UnwindSafe for Ui<B>

§

impl<B> Forget for Ui<B>

§

impl<B> Freeze for Ui<B>
where B: Freeze, *const u8 is !null: Freeze, PhantomData<(WidgetId, WidgetSpec)>: Freeze, PhantomData<(WidgetId, Vec<WidgetId>)>: Freeze, PhantomData<(WidgetId, ())>: Freeze, PhantomData<(WidgetId, Vec<RowSet>)>: Freeze, PhantomData<(WidgetId, Vec<RowKey>)>: Freeze, PhantomData<(MenuId, Vec<MenuItemId>)>: Freeze, PhantomData<(MenuItemId, MenuId)>: Freeze, PhantomData<(MenuId, MenuId)>: Freeze, PhantomData<(MenuId, MenuItemId)>: Freeze, PhantomData<(ImageResourceId, usize)>: Freeze, PhantomData<(MotionId, ActiveMotion)>: Freeze, PhantomData<(TimerId, MotionId)>: Freeze, PhantomData<(TrayIconId, TrayIconSpec)>: Freeze, PhantomData<(WidgetId, Vec<Box<dyn FnMut()>>)>: Freeze, PhantomData<(WidgetId, Vec<Box<dyn FnMut(i32, i32)>>)>: Freeze, PhantomData<(MenuItemId, Vec<Box<dyn FnMut()>>)>: Freeze, PhantomData<u8>: Freeze, PhantomData<(WidgetId, Vec<ThemeOverride>)>: Freeze, PhantomData<(WidgetId, (f32, f32))>: Freeze, PhantomData<(WidgetId, (i32, i32))>: Freeze, PhantomData<(WidgetId, Vec<ColumnSpec>)>: Freeze, PhantomData<(WidgetId, Vec<Vec<String>>)>: Freeze, PhantomData<(WidgetId, u32)>: Freeze, PhantomData<(WidgetId, (u32, u32))>: Freeze, PhantomData<(WidgetId, bool)>: Freeze, PhantomData<(WidgetId, WindowOptions)>: Freeze, PhantomData<(WidgetId, DragSourceOptions)>: Freeze, PhantomData<(WidgetId, DragTargetOptions)>: Freeze, PhantomData<(WidgetId, GpuDegradationPolicy)>: Freeze, PhantomData<Slot>: Freeze, PhantomData<usize>: Freeze, PhantomData<LayoutNodeId>: Freeze, PhantomData<(LayoutCacheKey, CachedLayout)>: Freeze, PhantomData<(WidgetId, LayoutNodeId)>: Freeze, PhantomData<UiEvent>: Freeze, *const ArcInner<UiProxyInner> is !null: Freeze, PhantomData<ArcInner<UiProxyInner>>: Freeze, *mut Counter<Channel<TaskCommand>>: Freeze, *mut Counter<Channel<TaskCommand>>: Freeze, *mut Counter<Channel<TaskCommand>>: Freeze, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Freeze, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Freeze, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Freeze, PhantomData<(TaskId, Box<dyn FnOnce(&mut Ui<B>, Box<dyn Any + Send>) -> Result<(), GuiError>>)>: Freeze, PhantomData<(TaskId, TaskHandle)>: Freeze, PhantomData<(OperationId, ())>: Freeze,

§

impl<B> Move for Ui<B>

§

impl<B> Unpin for Ui<B>
where B: Unpin, *const u8 is !null: Unpin, Arc<Vec<Vec<String>>>: Unpin, Arc<Vec<u8>>: Unpin, Box<dyn FnMut()>: Unpin, Box<dyn FnMut(i32, i32)>: Unpin, Box<TrackSizingFunction>: Unpin, &'static str: Unpin, Arc<UiProxyInner>: Unpin, *mut Counter<Channel<TaskCommand>>: Unpin, *mut Counter<Channel<TaskCommand>>: Unpin, *mut Counter<Channel<TaskCommand>>: Unpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Unpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Unpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: Unpin, Box<dyn FnOnce(&mut Ui<B>, Box<dyn Any + Send>) -> Result<(), GuiError>>: Unpin, Arc<Atomic<bool>>: Unpin,

§

impl<B> UnsafeUnpin for Ui<B>
where B: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(WidgetId, WidgetSpec)>: UnsafeUnpin, PhantomData<(WidgetId, Vec<WidgetId>)>: UnsafeUnpin, PhantomData<(WidgetId, ())>: UnsafeUnpin, PhantomData<(WidgetId, Vec<RowSet>)>: UnsafeUnpin, PhantomData<(WidgetId, Vec<RowKey>)>: UnsafeUnpin, PhantomData<(MenuId, Vec<MenuItemId>)>: UnsafeUnpin, PhantomData<(MenuItemId, MenuId)>: UnsafeUnpin, PhantomData<(MenuId, MenuId)>: UnsafeUnpin, PhantomData<(MenuId, MenuItemId)>: UnsafeUnpin, PhantomData<(ImageResourceId, usize)>: UnsafeUnpin, PhantomData<(MotionId, ActiveMotion)>: UnsafeUnpin, PhantomData<(TimerId, MotionId)>: UnsafeUnpin, PhantomData<(TrayIconId, TrayIconSpec)>: UnsafeUnpin, PhantomData<(WidgetId, Vec<Box<dyn FnMut()>>)>: UnsafeUnpin, PhantomData<(WidgetId, Vec<Box<dyn FnMut(i32, i32)>>)>: UnsafeUnpin, PhantomData<(MenuItemId, Vec<Box<dyn FnMut()>>)>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<(WidgetId, Vec<ThemeOverride>)>: UnsafeUnpin, PhantomData<(WidgetId, (f32, f32))>: UnsafeUnpin, PhantomData<(WidgetId, (i32, i32))>: UnsafeUnpin, PhantomData<(WidgetId, Vec<ColumnSpec>)>: UnsafeUnpin, PhantomData<(WidgetId, Vec<Vec<String>>)>: UnsafeUnpin, PhantomData<(WidgetId, u32)>: UnsafeUnpin, PhantomData<(WidgetId, (u32, u32))>: UnsafeUnpin, PhantomData<(WidgetId, bool)>: UnsafeUnpin, PhantomData<(WidgetId, WindowOptions)>: UnsafeUnpin, PhantomData<(WidgetId, DragSourceOptions)>: UnsafeUnpin, PhantomData<(WidgetId, DragTargetOptions)>: UnsafeUnpin, PhantomData<(WidgetId, GpuDegradationPolicy)>: UnsafeUnpin, PhantomData<Slot>: UnsafeUnpin, PhantomData<usize>: UnsafeUnpin, PhantomData<LayoutNodeId>: UnsafeUnpin, PhantomData<(LayoutCacheKey, CachedLayout)>: UnsafeUnpin, PhantomData<(WidgetId, LayoutNodeId)>: UnsafeUnpin, PhantomData<UiEvent>: UnsafeUnpin, *const ArcInner<UiProxyInner> is !null: UnsafeUnpin, PhantomData<ArcInner<UiProxyInner>>: UnsafeUnpin, *mut Counter<Channel<TaskCommand>>: UnsafeUnpin, *mut Counter<Channel<TaskCommand>>: UnsafeUnpin, *mut Counter<Channel<TaskCommand>>: UnsafeUnpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: UnsafeUnpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: UnsafeUnpin, *mut Counter<Channel<(TaskId, Box<dyn Any + Send>)>>: UnsafeUnpin, PhantomData<(TaskId, Box<dyn FnOnce(&mut Ui<B>, Box<dyn Any + Send>) -> Result<(), GuiError>>)>: UnsafeUnpin, PhantomData<(TaskId, TaskHandle)>: UnsafeUnpin, PhantomData<(OperationId, ())>: UnsafeUnpin,

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.