News

Warp: Rust’s new web framework

2 min read

Warp is a new Rust web framework. Built by Sean McArthur and Carl Lerche, it’s a tool for building and managing web servers. More specifically, it was designed to give developers more control over how they to configure routes within their services.

It’s worth pointing out that Rust’s Warp shouldn’t be confused with Haskell’s Warp – in the Haskell world, Warp is a lightweight web server for WAI applications.

This article was amended 7.25.2019 to clarify that Rust’s Warp framework and Haskell’s Warp frameworks are different.

What’s the thinking behind Rust’s Warp framework?

In a blog post announcing the framework, McArthur explains that the inspiration for Warp came out of his experience working with many different frameworks and tools – most recently Node.js.

He writes:

“I found that I often times need to configure predicates, like certain headers required, query parameters needed, etc, and sometimes, I need to configure that a set of routes should be ‘mounted’ at a different path, and possibly want certain predicates there too. I noticed the concept of mounting or sub-routes or sub-resources or whatever the framework calls them didn’t feel… natural, at least to me.”

With this challenge setting the context for Warp, McArthur’s love of Rust and the highly functional aspect of Scala tools like Finch and Akka helped to lay the technical foundations for the web framework.

Central to the framework are filters.

Read next: Will Rust replace C++?

What are filters in the Warp web framework?

Filters are a feature that makes configuring endpoints easier. McArthur explains by saying they are “a function that can operate on some input… and returns some output, which could be some app-specific type you wish to pass around, or can be some reply to send back as an HTTP response.”

The advantage of this is that if you are trying to “piece together data from several different places of a request before you have your domain object” you can treat each source as a ‘filter’ and combine them in a relatively straightforward manner. McArthur repeatedly uses the word ‘natural’ – to put it another way, it makes things easier and cleaner for the developer.

Read next: Rust 1.28 is here with global allocators, nonZero types and more

The Rust ecosystem is growing

It’s not news that Rust is a hugely popular programming language. In this year’s Stack Overflow survey, Rust was listed as the most loved language by respondents (3 years running!). However, it hasn’t seen extensive and rapid growth despite its advantages – with a growing ecosystem of tools like Warp that could well change over the next couple of years.

Melisha Dsouza

Share
Published by
Melisha Dsouza
Tags: RustWarpWAI

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago