专栏/Rust语言24个绝佳框架、项目及资料库

Rust语言24个绝佳框架、项目及资料库

2021年11月18日 08:00--浏览 · --喜欢 · --评论
粉丝:1884文章:37


Rust has a very lively and fast-paced open source ecosystem, with a ton of contributors working on a ton of awesome projects.

Rust拥有一个无比活跃且快节奏的开源生态系统,海量贡献者在这个系统中开展海量优质项目。

And if you are asking – what can I build in Rust? The answer is almost everything.

而如果你还感到困惑:我能借助Rust打造什么呢?答案是:它几乎无所不能。

This article will feature some of the open-source Rust libraries, frameworks, and repositories that could be useful to study or use for your own project.

本文将对一些开源Rust资料库、框架及储存库进行介绍,它们值得研究,而且或许还能直接运用到你的项目中去。

For your convenience, I’ve split them into fields such as web development, game development, blockchain, and others. Let’s dig in!

为了方便起见,我将分领域进行介绍,分别涵盖网页开发、游戏开发、区块链和其他领域。咱们开动吧!

Web development frameworks for Rust

Rust网站开发框架

Can you build a web app with Rust? Definitely!

你能用Rust建设一个网站应用吗?当然能!

Rust has multiple extremely fast web frameworks – Rocket, Actix Web, and Yew – and you can use the one that matches your needs and preferences.

Rust拥有多个极其快速的web框架——Rocket、Actix Web以及Yew——你可以根据自己的需求和偏好自行选择。


Rocket

Rocket is the most accessible web framework in the Rust ecosystem for beginners. It is highly customizable and helps you kickstart a new application quickly. At the same time, it avoids a lot of unnecessary boilerplate. Rocket also has many features included, which means that you won’t need to go far from the framework to build everything you need.

Rocket是Rust生态系统中最适合初学者使用的web框架。它的可定制程度很高能够帮助快速启动一个新的应用程序。同时,它也规避了许多不必要的样板文件。Rocket还许多功能,这意味着,在构建你需要的一切的时候,你都无需远离这个框架。

In contrast to Actix Web, the framework runs on nightly Rust – the “experimental” version of the language.

与Actix Web相比,该框架在所谓的nightly Rust上运行——这是该语言的“实验”版本。

Actix Web

Actix Web is usually thought to be more performant and stable than Rocket. Underneath, it works with the actor model used in Erlang and Akka.

人们通常认为Actix Web比Rocket性能更好、更稳定。在底层,它与Erlang和Akka中使用的actor模型一工作。

In contrast to Rocket, it’s less “batteries included”, meaning that you will most likely need to use third-party libraries for extra functionality.

与Rocket相比,它“内置组件”更少,这意味着你很可能需要使用第三方资料库来实现额外的功能。

Yew

Yew is a Rust framework for creating web apps with WebAssembly. Among its main benefits, it lists a component-based framework like in React and Elm, outstanding performance because of the multi-thread support, and JavaScript interoperability.

Yew 是一个Rust框架,用于通过WebAssembly创建web应用。它的主要优点是,它列出了一个基于组件的框架——这和ReactElm是一样的;由于多线程支持,它具有出色的性能以及JavaScript的互操作性。

As of now, it is not production-ready but should be an excellent choice for side projects and internal tooling, especially if you want to work with WASM.

到目前为止,它还不能用于生产,但是对于编外项目和内部工具来说,它应该是一个很好的选择——特别是如果想使用WASM的话

Zola

If you need something quick and simple to serve a static website, Zola is a fantastic tool to create fast and scalable web pages without any other dependencies or JS bloat.

如果你需要一快速和简单的工具服务静态网站,那么Zola是一个奇妙的工具,它可以帮助创建快速、可扩展网页,没有任何其他依赖关系或JS膨胀。

Warp

Warp is a web server framework written in Rust. In comparison to Rocket and Actix, it is rather slim for a web framework and will provide you only with basic functionality out of the box.

Warp是一个用Rust编写的web服务器框架。作为一个web框架,与Rocket和Actix相比,它显得相当精简,只提供基本的开箱即用功能。

Game development

游戏开发

Rust is exceptional for game development for the same reason that C++ is: it is predictably performant. Here are some of the engines you can use to build your own Rust game.

与C++一样,Rust在游戏开发领域也有上佳表现:它具备让人感到踏实的性能表现以下介绍的是一些游戏引擎,借助它们,你可以创建自己的Rust游戏。

Bevy

Two of the main Rust game engines are Bevy and Amethyst. Among them, Bevy is the newer and cooler one. It is a simple, data-driven engine and can essentially be called Amethyst 2.0 since it is heavily inspired by it.

Rust的两个主要游戏引擎分别是Bevy和Amethyst。其中,Bevy 更新,也更酷。是一个简单的数据驱动的引擎,本质上可以被称为Amethyst 2.0,因为它很大程度上受到了后者的启发。

For more info on Bevy, you can check out the Bevy book.

欲知更多关于Bevy的信息,你可以参看Bevy 手册

Amethyst

Amethyst is the more mature one of the two and, because of that, has more features that you might need for a large-scale project and better integrations with 3rd party libraries. But, Bevy is catching up fast. If you are searching for an engine for your new project, I’d recommend looking at them both and seeing which one you like better.

二者相比较的话,Amethyst更加成熟。正因为如此,它拥有更多你在大型项目中可能用得着的特性,并与第三方资料集成度也更好。但是,Bevy正在迎头赶上。如果你正在为你的新项目寻找引擎的话,我建议是你把这两个引擎都研究一下,看看自己更喜欢哪一个。

ggez

If you are searching for something simple to start off, ggez is a lightweight cross-platform game framework for making 2D games with minimal friction.

如果你找的是一个简单的工具用于起步阶段的话,ggez是一个轻量级的跨平台游戏框架,可以帮助你在阻力最小的情况下开发2D游戏。

Rust语言24个绝佳框架、项目及资料库

If you want to read more on game development in Rust, check out Are we game yet?

如欲了解更多在Rust上开发游戏的内容,请参看开始游戏了吗?

Operating systems

操作系统

Rust语言24个绝佳框架、项目及资料库

Rust is an excellent alternative to C in operating system development since it offers the same level of performance while taking care of memory safety. Actually, developers are investigating the possibility of adding Rust to the Linux kernel, and Microsoft is experimenting with it as well.

Rust在操作系统开发中是C语言的绝佳替代品,因为它在保证内存安全的同时提供了相同水的性能。实际上,开发人员正在研究将Rust添加到Linux内核的可能性,微软也在对此展开试验。

Here are some open-source operating systems that are written purely in Rust:

以下是一些纯粹使用Rust语言编写的开源操作系统:

Redox

Redox is an operating system written in Rust that uses Rust’s innovations to build a modern microkernel.

Redox是一个用Rust编写的操作系统,借助Rust的创新来构建现代微核。

intermezzOS

intermezzOS is a teaching operating system, specifically focused on introducing systems programming concepts to experienced developers from other programming areas.

intermezzOS是一教学操作系统,侧重于向来自其他编程领域的有经验的开发人员介绍系统编程概念。

Theseus

Theseus is a new OS written in Rust that presents a novel OS structure and claims to avoid the phenomenon of state spill, a thing that occurs when one entity’s state is permanently changed through interactions with another.

Theseus 是一个用Rust编写的新操作系统,它提出了一个新的操作系统结构,并声称可以避免状态溢出现象——即一个实体的状态通过与另一个实体的交互而永久改变。

There’s quite a lot to read about – here’s a paper on the project.

这方面还有很多东西可以读,详情请参看这篇文章 

GUI development

图形用户界面开发

Rust语言24个绝佳框架、项目及资料库

While Rust isn’t well known for its capability for building captivating user interfaces, there’s still a lot of good libraries to build GUIs with.

虽然Rust在构建吸引人的用户界面方面并不出名,但仍然有很多好的资料库可以用来构建图形用户界面

Druid

Druid is an experimental Rust-native UI toolkit with a focus on building simple, polished user experiences. It is data-oriented and inspired by modern frameworks such as Flutter, SwiftUI, and others.

Druid 是一个实验性的Rust原生UI工具包,专注于构建简单、精致的用户体验。它是面向数据的,并受到了Flutter、SwiftUI等现代框架的启发。

To learn more about it, you can check out the Druid book.

如欲了解更多,请参看Druid 手册

Iced

Iced is a cross-platform GUI library with a focus on simplicity and type safety. It’s heavily inspired by Elm. While it is still experimental right now, it is an excellent option for creating GUIs right in Rust for your side project.

Iced是一个关注简洁性和类型安全的跨平台图形用户界面库。它很大程度上受到了Elm的启发。虽然它现在还处于实验阶段,但它是在Rust中为项目创建图形用户界面的绝佳选择。

The Orbital Widget Toolkit

轨道部件工具包

The Orbital Widget Toolkit is a cross-platform toolkit for building scalable user interfaces with Rust. It’s focused on speed, ease of use, and cross-platform compatibility.

轨道部件工具包是一个跨平台的工具包,用于借助Rust构建可扩展用户界面。它专注于速度、易用性和跨平台兼容性。

Tauri

Tauri is a framework for building desktop applications for Windows, Linux, and macOS. With it, you can use any front-end framework that compiles to HTML/CSS/JS for building UIs, and Rust as the backend.

Tauri 是用于为Windows、Linux和macOS构建桌面应用的框架。有了它,你可以使用任何可以编译成HTML/CSS/JS来构建用户界面的前端框架,并将Rust作为后端。

Rust语言24个绝佳框架、项目及资料库

If you want to learn more about GUI development possibilities in Rust, here’s a big post that covers most of the libraries.

如欲了解更多关于Rust中开发图形用户界面的可能性,可以参看这篇干货贴,里面涵盖了大部分资料库。

Blockchain

区块链

Rust语言24个绝佳框架、项目及资料库

OpenEthereum

The main goal of OpenEthereum is to be the fastest, lightest, and most secure Ethereum client. It is developed with Rust and claims to provide core infrastructure that is essential for speedy and reliable services.

Open以太坊 的主要目标是成为最快、最轻、最安全的以太坊客户端。它是Rust开发的,并声称提供了对快速可靠服务至关重要的核心基础设施。

Lighthouse

Lighthouse is an open-source Ethereum 2.0 client, written in Rust and maintained by Sigma Prime.

Lighthouse 是一个开源以太坊2.0客户端,是用Rust编写的,由Sigma Prime维护。

Parity Technologies: Polkadot and Substrate

奇偶校验技术:Polkadot和Substrate

Parity Technologies works on building blockchain infrastructure for the decentralized web.

奇偶校验技术致力于为去中心化的网络构建区块链基础设施。

Among its projects are Substrate, a modular framework for blockchain development, and Polkadot, a network of blockchains. Both of these projects heavily use Rust in their implementations.

该公司的项目包括用于区块链开发的模块化框架Substrate和区块链网络Polkadot。这两个项目实现过程都大量借助了Rust语言

Other projects

其他项目

Here are some of the projects that don’t fit into any given category. Hope you can find something awesome in this collection of “things”. :)

以下项目不属于任何特定类别。愿你能在这些“东西”中找到一些很棒的东西。:)

Servo

Servo is a web engine prototype written in Rust. It’s the result of Mozilla’s work on creating a new, open-source browser engine. In 2020, Servo moved on from Mozilla to being hosted by the Linux Foundation.

Servo 是一个用Rust编写的web引擎原型。Mozilla致力于创建一个新的开源浏览器引擎,而Servo就是其努力的成果。2020年,Servo从Mozilla转向Linux基金会托管。

Servo is supposed to be safer than the browsers written in C++ due to Rust’s memory safety guarantees that reduce the number of vulnerabilities.

Servo 被认为比用C++编写的浏览器更安全,因为Rust的内存安全保证能够减少漏洞数量。

swc

swc is a superfast JavaScript/TypeScript compiler. In comparison to Babel, it has been benchmarked to increase the compilation speed at least 18 times.

swc 是一个超快的JavaScript/TypeScript编译器。与Babel相比,它的编译速度至少提高了18倍。

Ruffle

Want to run all the cool Flash games that Adobe has recently disabled support for? You can use Ruffle, a Flash player emulator written in Rust.

想运行Adobe最近禁用的所有超酷的Flash游戏吗?你可以使用Ruffle它是一个用Rust编写的Flash播放模拟器。

You can try it out on ruffle.rs.

点击ruffle.rs试试吧。

Lunatic

Lunatic is an experimental platform that uses WASM instances as actors to structure execution. It is heavily inspired by Erlang.

Lunatic 是一个实验平台,它使用WASM实例作为参与者来构建执行。它很大程度上受到了Erlang的启发。

It is supposed to unite the good sides of WASM and Erlang, enabling you to build actor-based systems that are both fault-tolerant and blazingly fast.

旨在将WASM和Erlang的优点整合起来,使能够构建既容错又快速的基于参与者的系统。

Starship

Starship is a fast, customizable, and intelligent prompt for those that want to make their shell cooler.

Starship 是一个快速的、可定制的智能提示符,适合那些希望自己的外壳更酷的人。

MeiliSearch

MeiliSearch is a powerful, fast, easy to use, and customizable search engine that’s also typo-tolerant. Now that’s a lot of adjectives! You can set it up for your own project instead of a custom and probably worse-performing solution.

MeiliSearch 是一个强大快速易于可定制、具有容错性的搜索引擎。这可真是一大堆形容词啊!可以项目里用它,而不是转投定制的,而且可能性能更差的解决方案。


投诉或建议