【Rust架构】Rust web框架比较

Chinese, Simplified

目录

 

  • 服务器框架
    • 过时的服务器框架
  • 客户框架
    •  过时的客户框架
  • 前端框架(WASM)
  • 补充库
    •  WebSocket
    •  模板
  • 对照
    • 高级框架
    • 低级框架
    • 前端框架
    • 中间件和插件
    • Websocket库
  • 资源
    • 博客文章
    • 演示
    • 使用Rust的真实世界Web项目
    • JS&asm.js&WASM

Server frameworks

使用Rust构建Web应用程序有几个有趣的框架:

如果您需要更低级别的控件,可以在这些库之间进行选择:

过时的服务器框架

Client frameworks

To build web clients with Rust, you can choose between these libraries:

Outdated client frameworks

Frontend frameworks (WASM)

Since WASM support is available in most browsers we can use Rust to build web applications :)

Supplemental libraries

Websocket

Templating

对照



高级框架

Name rocket iron actix-web nickel gotham rouille Thruster jsonrpc ease
License Rocket license Iron license Actix-web license Nickel license Gotham license Rouille license Thruster license Jsonrpc license Ease license
Github Stars Rocket stars Iron stars Actix-web stars Nickel stars Gotham stars Rouille stars Thruster stars Jsonrpc stars Ease stars
Contributors Rocket contributors Iron contributors Actix-web contributors Nickel contributors Gotham contributors Rouille contributors Thruster contributors Jsonrpc contributors Ease contributors
Server yes yes yes yes yes yes yes no no
Client no no yes no no no no yes yes
Base framework hyper hyper tokio hyper hyper tiny-http tokio hyper hyper
HTTPS support   yes yes no yes ?   - -
HTTP/2 support   ? yes ? no ?   ? ?
Async no   yes   yes   yes  

 

Low-Level Frameworks

Name hyper h2 tiny-http tk-http
License Hyper license H2 license Tiny-http license Tk-http license
Github Stars Hyper stars H2 stars Tiny-http stars Tk-http stars
Contributors Hyper contributors H2 contributors Tiny-http contributors Tk-http 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

Name yew stdweb percy dodrio sauron seed ruukh draco squark willow smithy
License Yew license Stdweb license Percy license Dodrio license Sauron license Seed license Ruukh license Draco license Squark license Willow license Smithy license
Github Stars Yew stars Stdweb stars Percy stars Dodrio stars Sauron stars Seed stars Ruukh stars Draco stars Squark stars Willow stars Smithy stars
Contributors Yew contributors Stdweb contributors Percy contributors Dodrio contributors Sauron contributors Seed contributors Ruukh contributors Draco contributors Squark contributors Willow contributors Smithy contributors
Stable Rust yes yes no ? no yes no yes no no no
Base framework stdweb - wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen wasm-bindgen
Virtual DOM yes ? yes yes yes yes yes yes yes ? ?

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

Name websocket ws-rs twist tungstenite tk-http actix-web
License Websocket license Ws-rs license Twist license Tungstenite license Tk-http license Actix-web license
Github Stars Websocket stars Ws-rs stars Twist stars Tungstenite stars Tk-http stars Actix-web stars
Contributors Websocket contributors Ws-rs contributors Twist contributors Tungstenite contributors Tk-http contributors Actix-web contributors
Server yes yes yes yes yes yes
Client yes yes yes yes yes yes
Base framework - / tokio mio tokio - / tokio tokio tokio
Async no / yes yes yes no / yes yes yes

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

Until 2017

Demos

Real-world web projects using Rust

JS & asm.js & WASM

Examples

Benchmark

本文地址
https://architect.pub/rust-web-framework-comparison
SEO Title
Rust web framework comparison