【Rust架构】Rust web框架比较
Chinese, Simplified
目录
- 服务器框架
- 过时的服务器框架
- 客户框架
- 过时的客户框架
- 前端框架(WASM)
- 补充库
- WebSocket
- 模板
- 对照
- 高级框架
- 低级框架
- 前端框架
- 中间件和插件
- Websocket库
- 资源
- 博客文章
- 演示
- 使用Rust的真实世界Web项目
- JS&asm.js&WASM
Server frameworks
使用Rust构建Web应用程序有几个有趣的框架:
- actix-web (homepage / repository / documentation / user guide)
- gotham (homepage / repository / documentation / examples)
- iron (homepage / repository / documentation)
- nickel (homepage / repository / documentation)
- rocket (homepage / repository / documentation)
- rouille ( - / repository / documentation)
- Thruster ( - / repository / documentation / examples)
- Tide ( - / repository / documentation / examples)
- tower-web ( - / repository / documentation / examples)
- warp ( - / repository / documentation / examples)
如果您需要更低级别的控件,可以在这些库之间进行选择:
- hyper (homepage / repository / documentation)
- tiny-http ( - / repository) / documentation)
- tk-http ( - / repository / - )
- h2 ( - / repository / - )
过时的服务器框架
Client frameworks
To build web clients with Rust, you can choose between these libraries:
- actix-web (homepage / repository / api docs)
- reqwest (- / repository / documentation)
- hyper (homepage / repository / documentation)
- jsonrpc (- / repository / documentation)
Outdated client frameworks
Frontend frameworks (WASM)
Since WASM support is available in most browsers we can use Rust to build web applications :)
- stdweb ( - / repository / documentation ) A standard library for the client-side Web
- yew ( - / repository / documentation ) - A frontend framework inspired by Elm and React (based on stdweb)
- percy ( homepage / repository / - ) - A modular toolkit for building isomorphic web apps
- seed ( homepage / repository / - ) - A Rust framework for creating web apps
- draco ( - / repository / documentation ) - A frontend framework inpired by Redux and Elm
- smithy ( - / repository / - documentation ) - A front-end framework
- squark ( - / repository / documentation ) - Rust frontend framework, for web browser and more.
- ruukh ( - / repository / documentation ) - A frontend framework inspired by Vue and React
- willow ( homepage - / repository / - ) - A frontend framework inspired by Elm
- dodrio ( - / repository / documentation ) - A fast, bump-allocated virtual DOM library.
- sauron ( - / repository / documentation - Sauron is an html web framework for building web-apps. It is heavily inspired by elm.
Supplemental libraries
Websocket
- websocket (homepage / repository / documentation)
- ws-rs (homepage / repository / documentation)
- tungstenite ( - / repository / documentation)
- tk-http ( - / repository / - )
- actix-web (homepage / repository / documentation)
Templating
- tera (homepage / repository / documentation)
- mustache (- / repository / documentation)
- liquid (- / repository / - )
- handlebars (- / repository / documentation)
- horrorshow (- / repository / documentation)
- maud (homepage / repository / documentation)
- askama (- / repository / - )
- stpl (- / repository / - )
- ructe (- / repository / documentation )
- typed-html (- / repository / documentation )
对照
高级框架
Low-Level Frameworks
Name | hyper | h2 | tiny-http | tk-http |
---|---|---|---|---|
License | ||||
Github Stars | ||||
Contributors | ||||
Server | yes | yes | yes | yes |
Client | yes | yes | ? | yes |
HTTPS support | yes | no | yes | yes |
HTTP/2 support | solicit | yes | ? | no |
Async | yes | yes | yes |
Frontend Frameworks
Middleware & Plugins
Name | iron | gotham | nickel | rouille | actix-web |
---|---|---|---|---|---|
Static File Serving | yes | no^ | yes | n/a | yes |
Mounting | yes | yes | yes | n/a | yes |
Logging | yes | yes | no | n/a | yes |
JSON-Body-Parsing | yes | yes | yes | n/a | yes |
Sessions | yes | yes | ? | n/a | yes |
Cookies | yes | yes | ? | n/a | yes |
PostgreSQL middleware | ? | no^ | yes | n/a | yes |
SQLite middleware | ? | no^ | yes | n/a | yes |
Redis middleware | ? | no^ | yes | n/a | yes |
MySQL middleware | ? | no^ | yes | n/a | yes |
(^ Planned in current roadmap)
Websocket Libraries
Examples
To compile or run the examples use Cargo. First clone this repo
git clone https://github.com/flosse/rust-web-framework-comparison
cd rust-web-framework-comparison/
and change to the desired frameworkd directory (e.g. cd iron/
) and type
cargo run --example hello_world
Then visit http://localhost:3000
to see the result.
Resources
Blog posts
2018
- Lessons learned on writing web applications completely in Rust
- Introducing Ruukh Framework
- Baby’s First Rust+WebAssembly module: Say hi to JSConf EU!
- Mix Rust Code (WebAssembly) with Vue Component
- Wicked Fast Web Servers in Rust
- Migrating to Actix Web from Rocket for Stability
- Creating a Rusty Rocket fuelled with Diesel
Until 2017
- Dose Response ported to WebAssembly!
- Rust and the case for WebAssembly in 2018
- wasm32-unknown-unknown landed & enabled
- How to Deploy a Rocket Application to Heroku
- Rust to WebAssembly, Made Easy
- Rust for the web
- Rocket on Fedora
- Announcing Gotham - A flexible web framework for stable Rust that does not sacrifice safety, security or speed.
- Announcing cargonauts - A Rust async web framework
- Writing a GitHub webhook with Rust! Part 1: Rocket
- Hello, Botket! (Rocket)
- Launching a URL Shortener in Rust using Rocket
- Rocket + sodiumoxide = ♥
- The Path to Rust on the Web
- Rendering Vector Map Tiles (Rust + asm.js demo)
- Compiling to the web with Rust and emscripten
- Basic 2FA in Rocket
- Building high performance REST APIs with Rust and Rocket
- Rocket Rocks! Using FromFormValue Traits to protect your website
- Building an Asynchronous Hyper Server
- JWT & Access Roles in Rocket
- Writing a basic JSON response web server in Rust using Iron
- Diesel Powered Rocket
- Using Stainless with Rocket
- Integration testing a service written in Rust and Iron
- Actually using Iron: A grumpy introduction to web development in Rust
- Using Rust for Webdev as a Hobby Programmer
- My adventures in Rust webdev
- Rust’s Iron Framework: First impressions
- Rust for Node.js developers
- A Rust-powered public web page in 5 minutes
- Rust and Rest
- Shipping forgettable microservices with Rust
- Writing a simple REST app in Rust
- Getting started with Rust
- Let's Build a Web Server in Rust
- Creating a basic webservice in Rust
- Iron on uWSGI
- Deploying a Rust App to Google App Engine
- async hyper
- Trying Rust for web services
- Are we web yet?
- Reimplementing ashurbanipal.web in Rust
- A web app with Nickel: From first line to Heroku deployment
- What features Iron does not have compared to a web server like nginx?
- Build an API in Rust with JWT Authentication using Nickel.rs
- Selective Middleware for Iron
- Rust for the Web - RESTful API in Rust, impressions
- Rust for Node developers
Demos
- exoskeleton - Iron
- Example webapp using React + Webpack - Iron
- rustwebapp - Iron and Postgres (r2d2)
- webrust - Iron and Postgres (r2d2)
- httptest - Iron
- nickel-todo-backend - Nickel and Postgres (r2d2)
- rust-playground - Iron
- rust-web-example - Iron + Diesel (r2d2) + Serde
- websocket chat - Actix: Browser Websocket + tcp chat
- diesel - Actix + Diesel
- json - Actix + serde_json or json_rust
Real-world web projects using Rust
- paste.rs - Rocket
- Portier - Iron and Redis
- yaus - Iron and SQLite
- racerd - Iron
- rust-passivetotal - Hyper
- mars - Hyper
- openfairdb - Rocket and Neo4j (r2d2)
- ruma - Iron and Posgres (diesel + r2d2)
- html2pdf - Iron
JS & asm.js & WASM
- hellorust.com - a website with news, resources and demos
Examples
- rust-webapp-template - Template project for Rust web app using stdweb
- rust-todomvc - an example application build with webplatform
- wasm-experiments - experiments with
wasm32-unknown-unknown
Benchmark
- TechEmpower Web Framework Benchmarks
- benchmarks - Rust web frameworks benchmarks
- which_is_the_fastest - Measuring response times (routing times) for each framework (middleware). Each framework has to have two features; routing and parsing path parameters.
本文地址
https://architect.pub/rust-web-framework-comparison
- 3426 次浏览
SEO Title
Rust web framework comparison