1.1 KiB
Raw Permalink Blame History

title, categories, tags, draft, slug, date
title categories tags draft slug date
给 Golang 开发者的 Rust 私房菜 01 千里之行,始于足下
Rust
rust
false rust-tutorial-01 2024-12-30T01:20:00+0800

Bilibili

{{< bilibili BV1BG6eYPE7L >}}

建议前往 B 站观看哦!


Rust 简介

Rust 是一门注重 内存安全高性能 的系统编程语言,通过所有权机制避免常见的内存错误。自 2021 年 Linux 内核 5.13 版本Rust 被正式引入用于提高内核模块如驱动程序的安全性减少内存管理漏洞。目前Rust 在内核中的应用仍处于初期阶段,未来可能会逐步扩大。

安装

brew install rust

HelloWorld

fn main() {
  println!("Hello, World!");
}

Hello Cargo

建立 cargo 项目

cargo new hello_cargo

源代码

fn main() {
  println!("Hello, cargo!");
}

构建项目

cargo build

运行项目

cargo run

检查项目

cargo check