KAS GUI
KAS is a pure-Rust GUI toolkit with stateful widgets:
- Pure, portable Rust
- Very fast and CPU efficient
- Flexible event handling without data races
- Theme abstraction layer
- Winit + WGPU shell supporting embedded accelerated content
- More portable shells: OpenGL, CPU-rendered, integration
- Complex text
- OS integration: menus, fonts, IME
- Accessibility: screen reader, translation
Documentation
- Wiki: Getting started, Configuration, Troubleshooting
- API docs: kas, kas-core, kas-widgets, kas-wgpu
- Prose: Tutorials, Blog
Examples
See the examples
directory and
kas-gui/7guis.
Design
Data or widget first?
KAS attempts to blend several GUI models:
- Like many older GUIs, there is a persistent tree of widgets with state
- Like Elm, event handling uses messages; unlike Elm, messages may be handled anywhere in the widget tree (proceeding from leaf to root until handled)
- Widgets have a stable identity using a path over optionally explicit components
- Like Model-View-Controller designs, data separation is possible; unlike Elm this is not baked into the core of the design
The results:
- Natural support for multiple windows (there is no central data model)
- Widget trees (without MVC) are static and pre-allocated, though efficient enough that maintaining (many) thousands of not-currently-visible widgets isn't a problem
- Support for accessibility (only navigation aspects so far)
- MVC supports virtual scrolling (including persistent IDs for unrealised widgets)
- MVC supports shared (
Rc
orArc
) data - MVC and stateful widget designs feel like two different architectures forced into the same UI toolkit
Crates and features
kas
is a meta-package over the core (kas-core
), widget library
(kas-widgets
), etc. See here.
At this point in time, kas-wgpu
is the only windowing/rendering implementation
thus kas
uses this crate by default, though it is optional.
Feature flags
The kas
crate enables most important features by default, excepting those
requiring nightly rustc
. Other crates enable fewer features by default.
See Cargo.toml.
Copyright and Licence
The COPYRIGHT file includes a list of contributors who claim copyright on this project. This list may be incomplete; new contributors may optionally add themselves to this list.
The KAS library is published under the terms of the Apache License, Version 2.0. You may obtain a copy of this licence from the LICENSE file or on the following webpage: https://www.apache.org/licenses/LICENSE-2.0