whatisgithub

What is mio?

tokio-rs/mio — explained in plain English

Analysis updated 2026-06-24

6,964RustAudience · developerComplexity · 4/5Setup · moderate

In one sentence

Mio is a low-level Rust library for non-blocking I/O that wraps each operating system's native event system (epoll, kqueue, IOCP) behind a single consistent API, used as the foundation for async runtimes like Tokio.

Mindmap

mindmap
  root((repo))
    What it does
      Non-blocking IO
      Event notifications
      Cross-platform API
    Supported Platforms
      Linux epoll
      macOS kqueue
      Windows IOCP
    Core Concepts
      Poll object
      Token per socket
      Event loop
    Use Cases
      Async runtimes
      High conn servers
      Network libraries
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

What do people build with it?

USE CASE 1

Build a high-performance TCP server in Rust that handles many simultaneous connections without blocking.

USE CASE 2

Write a custom async networking library on top of Mio's event loop, allocating nothing at runtime after setup.

USE CASE 3

Port async networking code across Linux, macOS, Windows, Android, and iOS using Mio's unified cross-platform API.

What is it built with?

Rust

How does it compare?

tokio-rs/miowatchexec/watchexecwarp-tech/warpgate
Stars6,9646,9746,976
LanguageRustRustRust
Setup difficultymoderateeasymoderate
Complexity4/52/54/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires solid Rust knowledge, beginners should use Tokio instead as Mio is a low-level building block not intended for direct use.

License not specified in the explanation.

So what is it?

Mio is a low-level Rust library for handling network connections without blocking. In most programs, when you read from a network socket, the program pauses and waits until data arrives. Non-blocking I/O means the program does not wait: instead, it asks the operating system to notify it when a socket is ready to read or write, and can do other work in between. Mio provides a thin, efficient layer over those operating system notifications. The library wraps the native event systems built into each major operating system. On Linux that is epoll, on macOS and BSD systems it is kqueue, and on Windows it is IOCP. Mio presents a consistent API across all of them, so code written with Mio works on Linux, macOS, Windows, Android, iOS, and several BSD variants without changes. The core concept is a Poll object, which you create once, then register sockets with it. Each socket gets a token, which is just a number you choose. You call poll repeatedly in a loop, and each time it returns a list of events. Each event includes the token of the socket that triggered it, and whether the socket is ready to read, write, or both. You then handle those events in whatever way your program needs. Mio explicitly does not include file operations, thread pools, or timers. Those are intentionally left out to keep the library focused and to avoid overhead that not every program needs. Higher-level libraries, such as Tokio, are built on top of Mio and add those features. The README notes that if you are new to async Rust networking, Tokio is likely a better starting point than using Mio directly. Mio is designed to allocate nothing at runtime after initial setup, which matters for programs handling large numbers of simultaneous connections where memory allocation overhead can become significant. It is used as a building block by several important Rust async runtimes and networking libraries.

Copy-paste prompts

Prompt 1
Show me how to write a basic TCP echo server in Rust using Mio that handles multiple simultaneous connections without blocking.
Prompt 2
I am building a custom async runtime in Rust and want to use Mio as the event loop. Walk me through setting up Poll, registering sockets with tokens, and processing events in a loop.
Prompt 3
How do I use Mio to watch both a TCP socket and a UDP socket at the same time and dispatch events from either in a single loop?
Prompt 4
I am new to Mio and want to understand how it compares to Tokio. Show me how the same simple server looks in both and explain when to choose Mio directly.

Frequently asked questions

What is mio?

Mio is a low-level Rust library for non-blocking I/O that wraps each operating system's native event system (epoll, kqueue, IOCP) behind a single consistent API, used as the foundation for async runtimes like Tokio.

What language is mio written in?

Mainly Rust. The stack also includes Rust.

What license does mio use?

License not specified in the explanation.

How hard is mio to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is mio for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.