Function kiss_ui::show_gui
[−]
[src]
pub fn show_gui<F>(init_fn: F) where F: FnOnce() -> Dialog + Send
The entry point for KISS-UI. The closure argument should initialize and call .show()
.
Blocks
Until all KISS-UI dialogs are closed.
Warning
No static widget methods from this crate may be called before this function is invoked or after it returns, with the exception of the closure passed to this function.
While this function is blocked and the IUP event loop is running, any reachable code is considered a "valid KISS-UI context" and may create and interact with widgets and dialogs.
After it returns, IUP is deinitialized and all static widget methods will panic to avoid undefined behavior.
Note: Send
bound
This closure will be called in the same thread where show_gui()
is invoked. No threading is
involved.
However, without the Send
bound it would be possible to move widget types outside
of the closure with safe code and interact with them after IUP has been deinitialized,
which would cause undefined behavior.
Since no widget types are Send
, this bound prevents this from happening without requiring
all widget methods to check if they were invoked in a valid context.