投票统计

是否原创:0 %

0 % Complete (success)

是否有价值:0 %

0% Complete

是否有素质:0 %

0% Complete (warning)

是否合法:0 %

0% Complete

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

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

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

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

 

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

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

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.

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

 

Rust网站开发框架

 

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

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


Web development frameworks for Rust

 

Can you build a web app with Rust? Definitely!

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


Rocket 框架

 

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

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

 

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.

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


Actix Web 框架

 

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

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

 

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.

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


Yew Web 框架

 

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

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

 

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.

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.


Zola 静态网站框架

 

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

 

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.


Warp Web框架

 

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

 

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.

 

游戏开发

 

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


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.

 


Bevy游戏引擎

 

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

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

编者按:Bevy是纯Rust编写的游戏引擎,这一点跟Godot不同,Godot是由社区驱动的外挂语言支持Rust。

 

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.

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


Amethyst游戏引擎

 

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

 

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.


ggez跨平台游戏框架

 

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

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

 

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.

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

 

操作系统

 

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

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


Operating systems

 

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.

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


Redox操作系统

 

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

 

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


intermezzOS教学操作系统

 

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

 

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


Theseus操作系统

 

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

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

 

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.

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

 

图形用户界面开发

 

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


GUI development

 

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.

 


Druid

 

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

如欲了解更多,请参看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.

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


Iced

 

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

 

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.

 

轨道部件工具包

 

轨道部件工具包是一个跨平台的工具包,用于借助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.

 


Tauri 应用开发框架

 

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

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

 

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.

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


Blockchain 区块链


OpenEthereum

 

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

 

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.

 


Lighthouse

 

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

 

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

 

奇偶校验技术:Polkadot和Substrate

 

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

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


Parity Technologies: Polkadot and 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.

 


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

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

 

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 is supposed to be safer than the browsers written in C++ due to Rust’s memory safety guarantees that reduce the number of vulnerabilities.


swc

 

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

 

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


Ruffle

 

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

点击ruffle.rs试试吧。

 

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.

You can try it out on ruffle.rs.


Lunatic

 

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

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

 

Lunatic is an experimental platform that uses WASM instances as actors to structure execution. It is heavily inspired by 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.


Starship

 

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

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


MeiliSearch

 

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.