explaingit

rust-windowing/winit

5,957RustAudience · developerComplexity · 3/5Setup · moderate

TLDR

Rust library that opens windows and delivers keyboard, mouse, scroll, and resize events across Windows, macOS, Linux, iOS, Android, and WebAssembly, without doing any drawing or rendering itself.

Mindmap

mindmap
  root((winit))
    What it does
      Window creation
      Input event delivery
      Cross-platform support
    Platforms
      Windows and macOS
      Linux Wayland X11
      iOS and Android
      WebAssembly
    Design
      Low-level only
      No rendering included
      Rust crate Cargo
    Use cases
      Desktop apps
      Game input loop
      WebAssembly apps
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Open a native window in a Rust application and receive keyboard and mouse events on any major operating system with one crate.

USE CASE 2

Build a cross-platform Rust game or graphics app that handles input events without writing platform-specific window code.

USE CASE 3

Port a Rust graphics project to WebAssembly by using winit's browser backend for window and event handling.

USE CASE 4

Combine winit with a Rust rendering library like wgpu to display graphics in a native window across desktop and web.

Tech stack

RustCargoWaylandWebAssembly

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Rust 1.85 or later, Android builds have additional SDK and NDK requirements beyond the standard desktop setup.

In plain English

winit is a Rust library for creating and managing windows at the operating system level. It handles window creation and event delivery across multiple platforms: Windows, macOS, Linux with Wayland and other compositors, iOS, Android, and WebAssembly. A program using winit can open a window and receive input events such as key presses, mouse movements, scroll actions, and window resize or close requests. The library is intentionally low-level. It handles opening windows and delivering events but does not draw anything to the screen itself. To display graphics, a developer uses a separate rendering library or graphics API that reads the platform-specific window handles winit exposes. The README links to community-maintained pages that track the state of Rust libraries for GUI applications and game development, for those looking for higher-level options that build on this foundation. Adding winit to a Rust project requires one line in the Cargo.toml dependency file. Full API documentation is hosted on docs.rs. A separate FEATURES.md file in the repository lists what the library covers and what is explicitly out of scope. Platform-specific behavior is documented in the winit::platform module of the API docs. The project is maintained by the rust-windowing organization, which holds weekly meetings and publishes notes online. Community discussion takes place in a Matrix chat room. The minimum supported Rust version is 1.85, and the project follows a documented policy for how that minimum changes over time. Android and Redox OS have separate version requirements noted in the README.

Copy-paste prompts

Prompt 1
Show me a minimal Rust winit program that opens an 800x600 window, prints every keyboard key press to the console, and exits when the user presses Escape.
Prompt 2
I want to build a cross-platform game loop in Rust using winit. Show me how to handle the event loop, track frame time between redraws, and call a render function each frame.
Prompt 3
How do I use winit on Android to receive touch events? Show me the Cargo.toml target config and the event types I need to match in the event loop.
Prompt 4
My winit app should redraw only when the window is resized. Show me how to listen for the resize event and call request_redraw at the right time.
Open on GitHub → Explain another repo

← rust-windowing on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.