Skip to main content

Crate windows_reactor

Crate windows_reactor 

Source
Expand description

§windows-reactor

Windows Reactor is a declarative WinUI 3 library for Rust. A Component owns state, receives parent-owned input, handles typed messages, and returns a View. Reactor reconciles each new view with the native UI tree and applies the required WinUI changes.

Add Reactor:

[dependencies]
windows-reactor = "0.100"

This counter shows the Component/View model:

use windows_reactor::*;

struct Counter {
    count: u32,
}

impl Component for Counter {
    type Input = ();
    type Message = ();

    fn create(_input: &(), _context: &ComponentContext<Self>) -> Self {
        Self { count: 0 }
    }

    fn update(&mut self, _message: (), _context: &ComponentContext<Self>) {
        self.count += 1;
    }

    fn view(&self, _input: &(), context: &mut ViewContext<Self>) -> View {
        StackPanel::new().spacing(8.0).children((
            TextBlock::new().text(format!("Count: {}", self.count)),
            Button::new()
                .on_click(context.forward())
                .content("Increment"),
        ))
    }
}

fn main() {
    App::run_component::<Counter>(()).unwrap();
}

Structs§

App
Starts and owns a Reactor application’s WinUI message loop.
AppBarButton
AppBarSeparator
AutoSuggestBox
BitmapIcon
Border
BreadcrumbBar
Button
CalendarDatePicker
CalendarView
Callback
A clonable callback used by Reactor events.
CancellationToken
A cooperative cancellation signal passed to background work.
Canvas
CheckBox
Color
An 8-bit-per-channel ARGB color.
ColorPicker
ComboBox
CommandBar
CommandBarFlyout
Primary and secondary commands displayed in a command-bar flyout.
ComponentContext
Capabilities available while creating or updating a component.
ComponentTask
A handle for observing or cancelling background work.
ContentDialog
Context
A typed context channel with a fallback value.
CornerRadius
Four corner radii measured in device-independent pixels (DIPs).
DatePicker
DateTime
DragDropAction
DragDropPolicy
DropDownButton
DroppedStorageItem
EffectKey
Identifies an effect within one component publication.
ElementObservation
Keeps an ElementRef observation registered.
ElementRef
A stable typed reference to a published native element.
Ellipse
EncodedImage
Immutable encoded bitmap data for an Image or ImageIcon source.
ExitTransition
A fade applied while an element is removed from the native tree.
Expander
FlipView
Flyout
Text or view content displayed in a flyout.
FontIcon
FontWeight
An OpenType font weight in the inclusive range 1 through 999.
Grid
GridView
GridViewItem
HyperlinkButton
Image
ImageIcon
InfoBadge
InfoBar
ItemsRepeater
Key
Stable identity for a keyed child, menu item, tree node, or command.
KeyAccelerator
A keyboard accelerator and its callback.
KeyAccelerators
A set of keyboard accelerators assigned to a control.
KeyedView
A view paired with stable reconciliation identity.
Line
ListBox
ListBoxItem
ListView
ListViewItem
LocalSender
Sends typed messages to a component’s queued update loop.
Menu
A context menu whose click callback receives the selected item’s label.
MenuBar
MenuBarItem
NavigationView
NavigationViewItem
NumberBox
PasswordBox
PathIcon
PersonPicture
Pivot
PivotItem
PointerEventInfo
Pointer state in element-local and window-relative device-independent pixels.
ProgressBar
ProgressRing
RadioButton
RadioButtons
RatingControl
Rectangle
RelativePanel
RepeatButton
ResourceOverrides
Theme resource values applied to a control subtree.
RichEditBox
RichText
Paragraph content for a RichTextBlock.
RichTextBlock
RichTextHyperlink
A hyperlink with display text and a target URI.
RichTextParagraph
A paragraph of rich-text inline values.
RichTextRun
A text run with optional bold and italic styling.
ScrollView
ScrollViewer
SelectorBar
SelectorBarItem
Slider
SlotView
Content assigned to one typed control slot.
SplitButton
SplitView
StackPanel
SwapChainPanel
SymbolIcon
TabView
TabViewItem
TeachingTip
TextBlock
TextBox
Thickness
Four edge values measured in device-independent pixels (DIPs).
TimePicker
TimeSpan
TitleBar
ToggleButton
ToggleSwitch
Tooltip
Text or view content displayed as a tooltip.
TreeNode
A keyed node in a tree view.
TreeView
VariableSizedWrapGrid
View
A declarative Reactor subtree.
ViewContext
Records view-time declarations for a component publication.
Viewbox
VirtualSource
A lazily materialized, keyed source for a virtualizing control.
WebView2
WindowConstraints
Optional window client-size limits in device-independent pixels (DIPs).
WindowRef
A token-bound capability for a component’s owning window.
WindowSize
Window client dimensions in device-independent pixels (DIPs).
WindowVisuals
Window appearance and client sizing requested by a component publication.

Enums§

AcceleratorKey
A key supported by Reactor keyboard accelerators.
AcceleratorModifiers
Modifier keys for a keyboard accelerator.
AppBarButtonSlot
AutoSuggestBoxSlot
AutomationHeadingLevel
Brush
A theme resource brush or a fixed solid color.
ButtonStyle
CalendarDatePickerSlot
ColorScheme
Whether the active application color scheme is light or dark.
ComboBoxSlot
CommandBarCommand
A keyed command owned by a command bar or command-bar flyout.
CommandBarSlot
ComponentTaskStatus
The delivery state of a component background task.
CompositionHostEvent
Layout and compositor events from a composition host.
ContentDialogResult
DatePickerSlot
DragDropOperation
DragKind
DroppedData
ExpanderSlot
FlipViewSlot
FlyoutPlacement
Placement of a flyout relative to its target.
GridLength
A Grid row or column size.
GridViewSlot
HorizontalAlignment
Horizontal placement within the space assigned by a parent.
InfoBarSeverity
IntegrationError
Failure reported by an asynchronous native integration request.
ListBoxSlot
ListViewSelectionMode
ListViewSlot
MenuBarSlot
MenuItem
A keyed item in a context menu.
NavigationViewBackButtonVisible
NavigationViewDisplayMode
NavigationViewItemSlot
NavigationViewPaneDisplayMode
NavigationViewSlot
NumberBoxSlot
Orientation
PasswordBoxSlot
PasswordRevealMode
PivotSlot
PumpDiagnostic
RadioButtonsSlot
ResourceValue
A supported WinUI resource override value.
RichEditBoxSlot
RichTextInline
An inline run, hyperlink, or line break in rich text.
ScrollBarVisibility
ScrollingScrollBarVisibility
SelectorBarItemSlot
SelectorBarSlot
SliderSlot
SplitViewDisplayMode
SplitViewSlot
Stretch
SwapChainPanelEvent
Rendering and layout events from a swap-chain panel.
Symbol
TabViewSlot
TeachingTipPlacementMode
TextBoxSlot
TextTrimming
TextWrapping
ThemeBrush
A brush resolved from the active WinUI theme resources.
TimePickerSlot
TitleBarSlot
ToggleSwitchSlot
TooltipPlacement
Placement of a tooltip relative to its target.
TreeViewSelectionMode
VerticalAlignment
Vertical placement within the space assigned by a parent.
ViewboxSlot
WindowBackdrop
Material used behind a window’s content.
WindowTheme
The theme requested for a window.
WindowTitleBarHeight
Height preset for an extended window title bar.

Traits§

AutomationExt
Adds UI Automation metadata to a native control.
CanvasChildExt
Places a concrete native control in its parent Canvas.
ChildrenControl
Assigns children to a native container.
CommandBarFlyoutExt
Adds a command-bar flyout to a view.
Component
A stateful unit that turns input and queued messages into a View.
ContentControl
Assigns one content view to a native content control.
FlyoutExt
Adds a flyout to a view.
FocusControl
Marks generated controls that accept programmatic focus.
GridChildExt
Places a concrete native control in its parent Grid.
IntoPayloadCallback
Converts a payload handler or typed message callback into an event callback.
IntoUnitCallback
Converts a zero-argument handler or typed message callback into an event callback.
IntoViews
Converts a statically shaped expression into positional views.
LayoutControl
Applies layout, opacity, margin, and exit-transition properties to native controls.
MenuExt
Adds a context menu to a view.
ReferenceControl
A native control that can be bound to an ElementRef.
RelativePanelChildExt
Places a concrete native control in its parent RelativePanel.
SlotsControl
Assigns single views or keyed collections to a control’s typed slots.
TooltipExt
Adds a tooltip to a view.
TreeViewExt
Supplies a keyed node hierarchy to a tree view.

Type Aliases§

CompositionHostError
Errors from composition-host requests.
FocusError
Errors from focus requests.
ImageSourceError
Errors from image-source requests.
SwapChainPanelError
Errors from swap-chain panel requests.
WebView2Error
Errors from WebView2 integration requests.