Web development

Rust's async I/O system allows you to build highly concurrent server applications, its WebAssembly compiler target makes it possible to write applications that run within the browser, and the crates.io library repository provides reusable libraries for most web standards and framework needs.

HistoryEdit

Rust was first publicly announced to the world as part of "Project Servo," a research project at Mozilla, the non-profit behind the Firefox web browser. Servo is a research project to design and implement a web browser for highly multithreaded computers, and is implemented primarily in Rust. Rust and Servo were mostly designed and implemented together up until Rust's 1.0 release, and both of them provide feedback for each other. Some well-isolated parts of Servo, like its implementation of CSS, are now being used in Firefox.

After Rust's stability plan was announced and crates.io was set up, the stage was set for a more well-rounded set of libraries to be developed. The first tagged release of Hyper, the most popular implementation of HTTP in Rust, was made in January 2015, a few months before Rust 1.0's release in May. Crates.io itself initially relied on bindings to a C library called civet for its HTTP server, though they are now working on migrating to hyper.

Many of Rust's web libraries are maintained by Mozilla under the Servo organization, such as the  url crate. Others, like  hyper , are independent projects. There are also frameworks and wrappers that use the lower-level libraries behind an easy-to-use facade for developing applications.

Crates implementing web standardsEdit

Notable, maintained crates implementing web standards and popular web formats
Crate Maintained by Description
 hyper (home) hyperium An implementation of HTTP, the internet protocol that web servers and user agents use to communicate
 rustls ctz An implementation of TLS, the security layer of "https" and other protocols
 native-tls sfackler Bindings to your operating system's built-in implementation of TLS, the security layer of "https" and other protocols
 url servo An implementation of the WHATWG URL, a parser for web addresses like http://rust-lang.org
 selectors servo An implementation of the W3C CSS selector specification, the part of a stylesheet that determines which elements to apply the style to
 html5ever servo An implementation of the WHATWG HTML parser, the file format of web documents
 serde_json serde An implementation of JSON (part of the ECMAScript standard), a common data interchange format
 xml-rs netvl An implementation of XML (available with a serde binding though  serde-xml-rs , a common data interchange format
 cssparser servo An implementation of the W3C CSS syntax specification, the file format of web stylesheets
 bbclash EndaHallahan An implementation of bbcode, a popular authoring format for user-contributed content
 pulldown-cmark raphlinus An implementation of markdown, a popular authoring format for user-contributed content
 comrak kivikakk An implementation of markdown, a popular authoring format for user-contributed content

Web server frameworksEdit

Notable, maintained web server crates
Crate Maintained by Description
 actix-web (home) JohnTitor Performance focused framework with lots of features. On the `tokio` runtime
 rocket (home) SergioBenitez Framework focused on ease of use, expressibility, and speed. Not yet async, requires nightly Rust
 tide yoshuawuyts In development framework on the async-std runtime
 tower tower-rs Library of reusable components for building clients and servers
 warp seanmonstar Newer framework with tokio async support and current best bet for GQL integration
 conduit conduit-rust Older framework with support for multiple HTTP server implementations. Used by crates.io

WebAssemblyEdit

Tutorial: Compiling from Rust to WebAssembly on MDN

Notable, maintained WebAssembly build and packaging crates
Crate Maintained by Description
 wasm-pack (home) ashleygwilliams A wrapper around other wasm/rust related tools, for webassembly that's intended to integrate with JavaScript
 wasm-bindgen rustwasm A bindings generator for bridging JavaScript and Rust
wapm Wasmer Inc. A first-class WebAssembly package manager and repository. Use this for packages that you don't want to put on NPM, particularly non-JavaScript wasm

Other web development cratesEdit

 juniper - GraphQL server library

 ammonia - HTML sanitizer

 marked (märkəd) - DOM manipulation library for HTML and XML

 kuchiki - DOM manipulation library for HTML and XML

See alsoEdit