Web development

From Rust Community Wiki
Revision as of 03:13, 3 September 2020 by Notriddle (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.

History[edit | edit source]

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 Cargo vec.svgurl crate. Others, like Cargo vec.svghyper , 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 standards[edit | edit source]

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

Web server frameworks[edit | edit source]

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

WebAssembly[edit | edit source]

Tutorial: Compiling from Rust to WebAssembly on MDN

Notable, maintained WebAssembly build and packaging crates
Crate Maintained by Description
Cargo vec.svgwasm-pack (home) ashleygwilliams A wrapper around other wasm/rust related tools, for webassembly that's intended to integrate with JavaScript
Cargo vec.svgwasm-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 crates[edit | edit source]

Cargo vec.svgjuniper - GraphQL server library

Cargo vec.svgammonia - HTML sanitizer

Cargo vec.svgmarked (märkəd) - DOM manipulation library for HTML and XML

Cargo vec.svgkuchiki - DOM manipulation library for HTML and XML

See also[edit | edit source]