Crate iui[][src]

iui, the improved user interface crate, is a simple (about 4 kLOC of Rust), small (about 800kb, including libui), easy to distribute (one shared library) GUI library, providing a Rusty user interface library that binds to native APIs via the libui and the ui-sys bindings crate. iui wraps native retained mode GUI libraries, like Win32API on Windows, Cocoa on Mac OS X, and GTK+ on Linux and elsewhere. Thus all iui apps have a native look and feel and start from a highly performant base which is well integegrated with the native ecosystem on each platform. Because it implements only the least common subset of these platform APIs, your apps will work on all platforms and won't have significant behavioral inconsistencies, with no additional effort on your part.

To use the library, add the following to your Cargo.toml:

"iui" = "0.3"

To build a GUI app with iui, you must:

  1. create a UI handle, initializing the UI library and guarding against memory unsafety
  2. make a window, or a few, with title and platform-native decorations, into which your app will be drawn
  3. add all your controls, like buttons and text inputs, laid out with both axial and grid layout options
  4. implement some callbacks for user input, taking full advantage of Rust's concurrency protections
  5. call UI::main, or take control over the event processing with an EventLoop, and voíla! A GUI!

For code examples, see the examples directory.

Modules

controls

Available user interface controls and related functionality.

draw

Functions and types related to 2D vector graphics.

menus

Menus that appear at the top of windows, and the items that go in them.

prelude

Common imports are packaged into this module. It's meant to be glob-imported: use iui::prelude::*.

Structs

EventLoop

Provides fine-grained control over the user interface event loop, exposing the on_tick event which allows integration with other event loops, custom logic on event ticks, etc. Be aware the Cocoa (GUI toolkit on Mac OS) requires that the first thread spawned controls the UI, so do not spin off your UI interactions into an alternative thread. You're likely to have problems on Mac OS.

UI

A handle to user interface functionality.

Enums

UIError

The error type returned by functions in this crate which might fail.