Networking

Why Rust?

A feather

Low footprint

Take control over resource usage to keep memory and CPU footprint to a minimum. Get help from the compiler to make sure you’ve got it right. And do this with an ecosystem that is productive and pleasant to use.

A shield

Secure and reliable

Rust’s powerful type checker prevents whole classes of bugs. Make sure you know exactly when and where state is shared and mutated. Get help catching points of failure — before deployment.

Connected gears

Concurrent at scale

Use any mixture of concurrency approaches that works for you. Rust will make sure you don’t accidentally share state between threads or tasks. It empowers you to squeeze every last bit of scaling, fearlessly.

Get started!

Rust has a growing ecosystem of easy-to-use libraries for the web. Here are just two examples:

POST some JSON

// This will POST a body of
//     `{"lang":"rust","body":"json"}`
let mut map = HashMap::new();
map.insert("lang", "rust");
map.insert("body", "json");

let client = reqwest::Client::new();
let res = client.post("http://httpbin.org/post")
    .json(&map)
    .send()?;
Learn more about reqwest

Handle a JSON POST

#[derive(FromForm)]
struct Task { name: String, completed: bool }

#[post("/", data = "")]
fn new(task: Form) -> Flash {
    if task.name.is_empty() {
        Flash::error(Redirect::to("/"),
            "Cannot be empty.")
    } else {
        Flash::success(Redirect::to("/"),
            "Task added.")
    }
}
Learn more about Rocket

Production use

Migrating our Push connection infrastructure to Rust has provided us with an easier to maintain code-base with a focus on correctness while delivering fantastic performance. We are now handling up to 20 million websocket connections at once during peak hours with Rust servers.

– Benjamin Bangert, Staff Engineer, Mozilla

Rust is foundational to the Linkerd project’s technology roadmap. Its type system allows us to build modular, testable, composable units without sacrificing runtime performance. What’s been most surprising, though, is how Rust’s lifetime/borrow checking system allows us to avoid large classes of resource leaks. After 2 years, I really can’t imagine using any other language for the job.

– Oliver Gould, CTO, Buoyant

Rust's powerful type system enables safe refactoring and catches many classes of bugs at compile time. Its low footprint and high performance, complemented by guaranteed memory safety and rock-solid error handling make it perfect for writing security critical and complex business logic for our backend. The ultra-high stability means that our Rust applications are the last part of our stack we ever have to worry about. We have been running a almost 100% Rust backend in production since end of 2015 and it has never failed us so far!

– Yann Leretaille, 1aim