A platform for writing fast networking code with Rust.

Get Started


Tokio's zero-cost abstractions give you bare-metal performance.


Tokio makes it easy to implement protocols and program asynchronously.


Tokio leverages Rust's ownership and concurrency model to ensure thread safety.


Tokio has a minimal footprint, and handles backpressure and cancellation naturally.

// A tiny async echo server with Tokio
extern crate futures;
extern crate tokio;
extern crate tokio_io;

use futures::{Future, Stream};
use tokio::executor::current_thread;
use tokio::net::TcpListener;
use tokio_io::{io, AsyncRead};

fn main() {
    // Bind the server's socket
    let addr = "".parse().unwrap();
    let tcp = TcpListener::bind(&addr).unwrap();

    // Iterate incoming connections
    let server = tcp.incoming().for_each(|tcp| {
        // Split up the read and write halves
        let (reader, writer) = tcp.split();

        // Copy the data back to the client
        let conn = io::copy(reader, writer)
            // print what happened
            .map(|(n, _, _)| {
                println!("wrote {} bytes", n)
            // Handle any errors
            .map_err(|err| {
                println!("IO error {:?}", err)

        // Spawn the future as a concurrent task

    .map_err(|err| {
        println!("server error {:?}", err);

    // Spin up the server on the event loop
    current_thread::run(|_| {