Bhaskar

State of UI,Console,Async in Rust

· bhaskar

State of UI in Rust

  • Rust UI ecosystem is diverse, similar to web frontend
  • Key capabilities: windowing, rendering, layout, text handling, input, accessibility
  • Win-it library improving windowing support
  • Rendering options: software, OpenGL, Vulkan/Metal/DirectX12, WGPU, Skia, WebRender
  • Text rendering challenges: WebRender, Swash, Cosmic Text
  • Layout strategies: flexbox/grid, stretch/fill, constraint-based
  • Input handling, especially IME, needs improvement
  • Trend towards declarative, reactive UI frameworks (e.g. Dioxus, Leptos, iced)
  • Areas needing work: accessibility, automation, documentation, compile times
  • Promising ecosystem, but gaps remain compared to mature frameworks

Source: https://www.youtube.com/watch?v=G9vXU2oXVPw&t=2450s

The Good, the Bad, and the Async

  • Async Rust enables high-capacity servers and microservices
  • Blocking I/O is simple but inefficient
  • Non-blocking I/O with busy waiting wastes CPU
  • Event polling is better but low-level and complex
  • Rust’s async/await and futures provide higher-level abstraction
  • Futures types: normal, dumb, and Lea (interacts with runtime)
  • Rust runtime: scheduler (tasks) and reactor (event poll)
  • Runtime provides async TCP listener and stream
  • Keep futures small, avoid self-references for performance/safety

Source: https://www.youtube.com/watch?v=yQs75EWddTA&t=942s

Console Based UI in RUST

  • TUIs: text-based interfaces, efficient alternative to GUIs
  • Use ANSI escape sequences for advanced terminal control
  • Popular libraries: ncurses, CDK, Ratatui (Rust-based)
  • Ratatui: lightweight, customizable, flexible TUI framework
  • Features: alternate screen, event handling, rendering modes
  • Rust: memory safe, performant, cross-platform
  • TUIs advantageous for efficiency, resources, accessibility
  • Various applications: games, file managers, monitoring tools
  • Active Ratatui community maintaining and improving library
  • Growing ecosystem of Rust-based TUI tools and libraries

Source: https://www.youtube.com/watch?v=NU0q6NOLJ20