Skip to main content

Module window

Module window 

Source
Expand description

The window’s measured size, and the registrations a runtime wakes its readers through.

The UI is authored here but measured by the Renderer, so the only way a Rust component can know how wide the window is, is for the Renderer to tell it. The Renderer sends one event when the size class changes and nothing in between, so this module is a single current value plus the list of readers that asked to be told when it changes. The Dioxus adapter’s use_window_size and use_node_size hooks are such readers.

Structs§

NodeSize
A node whose measured size a reader follows.
NodeSizeSubscription
A registration for one node’s measured size, made with subscribe_node.
WindowSize
The window’s size, as the Renderer last measured it.
WindowSizeSubscription
A registration for changes of the window’s size class. Dropping it ends the registration, so a runtime keeps it for as long as the reader it wakes is alive.

Functions§

next_node_token
A fresh name for a node a screen wants measured. Never zero, which is the window’s.
node_size
The size a node last measured, or a zero size for one nothing has reported yet.
subscribe
Registers notify to be called each time the window’s measured size changes. What notify does is the runtime’s business: mark a scope dirty, most often.
subscribe_node
Registers notify to be called each time the node named token reports a size in a different class.
window_size
The size the Renderer last reported. Available outside a component too.