structura-lib

Crates.iostructura-lib
lib.rsstructura-lib
version0.2.3
created_at2025-07-02 03:45:34.913001+00
updated_at2025-07-12 19:11:08.553502+00
descriptionA Rust GUI Framework.
homepagehttps://github.com/NathanLaan/structura/
repositoryhttps://github.com/NathanLaan/structura/
max_upload_size
id1734450
size134,081
Nathan (NathanLaan)

documentation

README

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 of Container and Component.

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.
Commit count: 0

cargo fmt