$ show emilk/egui
egui is a mature, cross-platform immediate-mode GUI library for Rust. Application code describes the UI every frame rather than retaining a widget tree; egui processes pointer, keyboard, and touch input, runs layout, paints built-in and custom widgets, and outputs a triangle mesh plus platform output such as clipboard changes, cursor updates, and an accessibility tree. The repository is organized as a Cargo workspace: `emath` and `ecolor` provide math and color primitives, `epaint` handles tessellation, text layout, and texture management, `egui` is the core UI layer, and `eframe` packages native (winit + glow/wgpu) and web (WASM/WebGL/WebGPU) backends. Extension crates add tables, image loaders, syntax highlighting, a testing harness (`egui_kittest`), and a large demo application with dozens of examples. This is purely an application/framework repository, not a data or research project. The architecture is cleanly layered: foundational math/graphics crates are decoupled from the immediate-mode UI state and from platform integrations. The codebase shows exceptionally high craftsmanship in areas such as scroll physics with kinetic coasting and rubber-banding, CPU-side tessellation with anti-aliased feathering, dynamic glyph texture atlases, and a robust accessibility integration via AccessKit. It has extensive snapshot and accessibility tests, per-crate changelogs, and CI workflows for linting, typo checks, link checking, and web preview deploys. The main maintenance risks are feature-flag complexity and the ongoing burden of keeping multiple rendering backends (glow, wgpu, web) behaviorally in sync, but the code is actively maintained and dependency pins are deliberate and documented.
The LLM identified 5 files worth highlighting for reuse:
Generic `History<T>` ring buffer for storing recent time-series values and computing min/max/mean plus exponential smoothing. Used for egui's frame-rate graphs, but implemented as an isolated math utility depending only on `emath`; it can be dropped into any telemetry, monitoring, or performance-measurement code.
Pure Rust axis-physics module for scroll areas: implements kinetic coasting, rubber-banding at edges, and critically damped springs in a frame-rate-independent way, with constants modeled from iOS touch behavior. It is self-contained and extractable into any scrollable UI or physics-based animation system.
Converts high-level 2D shapes (rects, circles, paths, bands, text) into GPU-ready triangle meshes with feathered anti-aliased edges. Handles rounding, shadows, gradients, and efficient mesh construction. This is a high-craft geometry kernel that could be reused or studied for any CPU-side vector graphics renderer.
Dynamic GPU texture atlas for glyphs and images, with subpixel binning, pre-rasterized discs, and delta-based updates. Demonstrates non-obvious cache-management and allocation strategies for text rendering; the underlying atlas pattern is reusable in any font/glyph rendering system.
Generic undo/redo stack with automatic merging of adjacent actions and configurable compression. Used by egui's text-editor demos but implemented as a standalone utility, making it easy to extract into any editor-style application that needs robust undo history.