8 releases
Uses new Rust 2024
| 0.2.3 | Jul 12, 2025 |
|---|---|
| 0.2.1 | Jul 6, 2025 |
| 0.1.5 | Jul 4, 2025 |
#1479 in GUI
419 downloads per month
82KB
2K
SLoC
Structura-Lib Rust GUI Framework
Structura is a GUI framework created to learn how to create a GUI framework in Rust. Maybe one day it will be "OK enough" to actually use for something, but you really should not use this.
The Structura GUI framework is based on cross-platform components, but has only been tested on Linux.
Dependencies
Structura is based on the following libraries:
- winit cross-platform window management library.
- softbuffer 2D buffer library.
- rusttype font library.
- Tokio, an event-driven, non-blocking I/O platform for writing asynchronous applications.
Architecture
Structura is being loosely designed around a Model-View-Controller (MVC) architecture.
The Structura UI components are designed around a fluent API where possible. For example:
let button1 = Button::default()
.set_text("Button 1!".to_string())
.on_click(|| {
println!("button1.on_click()");
});
Traits
Component: Displays output to users and/or allows users to interact. Interaction may be via mouse and/or keyboard.Container: Can hold a list of child containers or components.ContainerComponent: Composition trait ofContainerandComponent.
Structs
- ContainerComponent: Row
- ContainerComponent: Column
- ContainerComponent: BorderLayout (Top, Bottom, Left, Right, Center)
- ContainerComponent: Panel: Holds a single
Component. - ContainerComponent: SplitPane: Vertical or Horizontal. Contains two children.
- ContainerComponent: Tabs
- Component: Button
- Component: ImageButton (Generalize the Button to display Text or Image?)
- Component: Image
- Component: TextArea
- Component: TextField (subset of
TextArea?)
Core API
- Model.
- View.
- Controller.
- Theme.
- Style support.
- Application.
- Event or Message system.
- Consolidate text rendering.
- Consolidate draw functions, such as
draw_border(). - Resizeable containers that change size with the window size and automatically resize child components.
- Add "parent" field to Containers. Resizeable containers can listen for parent container resizing.
- Add font field to TextArea.
- Modify TextArea to make scrollbars clickable and draggable.
Dependencies
~4–23MB
~304K SLoC