.rs
Code
Rust 源代码
Rust 文件包含无需垃圾回收器即可保证内存安全的系统编程语言的源代码。Rust 使用所有权系统和借用检查器在编译时防止数据竞争和空指针错误。
MIME 类型
text/x-rust
类型
文本
压缩
无损
优点
- + Memory safety guaranteed at compile time — no GC needed
- + Performance comparable to C and C++
- + Fearless concurrency — data races are compile errors
- + Excellent tooling: Cargo, rustfmt, clippy
缺点
- − Steep learning curve — ownership and lifetimes take time to master
- − Longer compilation times than Go or C
- − Smaller ecosystem than Python, Java, or JavaScript
何时使用 .RS
在系统编程、WebAssembly、游戏引擎、嵌入式系统以及任何需要无 GC 开销的内存安全软件中使用 Rust。
技术细节
Rust 的所有权系统在编译时跟踪数据生命周期。每个值都有一个唯一的所有者,引用遵循借用规则,借用检查器防止释放后使用和数据竞争。Cargo 是构建系统和包管理器。
历史
Graydon Hoare 于 2010 年在 Mozilla 开始开发 Rust。1.0 版本于 2015 年发布。Rust 基金会于 2021 年成立。自 2016 年以来,Rust 一直是 Stack Overflow 调查中最受喜爱的编程语言。