mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 06:17:49 +00:00
Update post 1 to Rust edition 2024
Branch post-01 and all later branches already were already updated to
edition = "2024" in commit 86ffa24e (Update to Rust 2024 edition,
2025-03-27).
This commit is contained in:
@@ -58,12 +58,12 @@ translators = ["ZAAFHachemrachid"]
|
|||||||
[`no_std` attribute]: https://doc.rust-lang.org/1.30.0/book/first-edition/using-rust-without-the-standard-library.html
|
[`no_std` attribute]: https://doc.rust-lang.org/1.30.0/book/first-edition/using-rust-without-the-standard-library.html
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
لقد أطلقتُ على المشروع اسم ”Blog_os“، ولكن بالطبع يمكنك اختيار اسمك الخاص. تُحدّد علامة ”bin“ أننا نريد إنشاء نسخة binary قابلة للتنفيذ (على عكس المكتبة) وتحدّد علامة ”--- Edition 2018“ أننا نريد استخدام [2018 edition] من Rust لصندوقنا. عندما نُشغّل الأمر، تُنشئ لنا الشحنة بنية الدليل التالية:
|
لقد أطلقتُ على المشروع اسم ”Blog_os“، ولكن بالطبع يمكنك اختيار اسمك الخاص. تُحدّد علامة ”bin“ أننا نريد إنشاء نسخة binary قابلة للتنفيذ (على عكس المكتبة) وتحدّد علامة ”--- Edition 2024“ أننا نريد استخدام [2024 edition] من Rust لصندوقنا. عندما نُشغّل الأمر، تُنشئ لنا الشحنة بنية الدليل التالية:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ Comenzamos creando un nuevo proyecto de aplicación en Cargo. La forma más fác
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
Nombré el proyecto `blog_os`, pero, por supuesto, puedes elegir tu propio nombre. La bandera `--bin` especifica que queremos crear un binario ejecutable (en contraste con una biblioteca), y la bandera `--edition 2018` indica que queremos usar la [edición 2018] de Rust para nuestro crate. Al ejecutar el comando, Cargo crea la siguiente estructura de directorios para nosotros:
|
Nombré el proyecto `blog_os`, pero, por supuesto, puedes elegir tu propio nombre. La bandera `--bin` especifica que queremos crear un binario ejecutable (en contraste con una biblioteca), y la bandera `--edition 2024` indica que queremos usar la [edición 2024] de Rust para nuestro crate. Al ejecutar el comando, Cargo crea la siguiente estructura de directorios para nosotros:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ rtl = true
|
|||||||
با ساخت یک اپلیکیشن جدید کارگو شروع میکنیم. سادهترین راه برای انجام این کار از طریق خط فرمان است:
|
با ساخت یک اپلیکیشن جدید کارگو شروع میکنیم. سادهترین راه برای انجام این کار از طریق خط فرمان است:
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
نام پروژه را `blog_os` گذاشتم، اما شما میتوانید نام دلخواه خود را انتخاب کنید. پرچمِ (ترجمه: Flag) `bin--` مشخص میکند که ما میخواهیم یک فایل اجرایی ایجاد کنیم (به جای یک کتابخانه) و پرچمِ `edition 2018--` مشخص میکند که میخواهیم از [ویرایش 2018] زبان راست برای کریت خود استفاده کنیم. وقتی دستور را اجرا میکنیم، کارگو ساختار پوشههای زیر را برای ما ایجاد میکند:
|
نام پروژه را `blog_os` گذاشتم، اما شما میتوانید نام دلخواه خود را انتخاب کنید. پرچمِ (ترجمه: Flag) `bin--` مشخص میکند که ما میخواهیم یک فایل اجرایی ایجاد کنیم (به جای یک کتابخانه) و پرچمِ `edition 2024--` مشخص میکند که میخواهیم از [ویرایش 2024] زبان راست برای کریت خود استفاده کنیم. وقتی دستور را اجرا میکنیم، کارگو ساختار پوشههای زیر را برای ما ایجاد میکند:
|
||||||
|
|
||||||
[ویرایش 2018]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[ویرایش 2024]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ Par défaut, toutes les crates Rust sont liées à la bibliothèque standard, qu
|
|||||||
Nous commençons par créer un nouveau projet d'application cargo. La manière la plus simple de faire est avec la ligne de commande :
|
Nous commençons par créer un nouveau projet d'application cargo. La manière la plus simple de faire est avec la ligne de commande :
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
J'ai nommé le projet `blog_os`, mais vous pouvez évidemment choisir le nom qu'il vous convient. Le flag `--bin` indique que nous voulons créer un exécutable (contrairement à une bibliothèque) et le flag `--edition 2018` indique que nous voulons utiliser l'[édition 2018] de Rust pour notre crate. Quand nous lançons la commande, cargo crée la structure de répertoire suivante pour nous :
|
J'ai nommé le projet `blog_os`, mais vous pouvez évidemment choisir le nom qu'il vous convient. Le flag `--bin` indique que nous voulons créer un exécutable (contrairement à une bibliothèque) et le flag `--edition 2024` indique que nous voulons utiliser l'[édition 2024] de Rust pour notre crate. Quand nous lançons la commande, cargo crée la structure de répertoire suivante pour nous :
|
||||||
|
|
||||||
[édition 2018]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[édition 2024]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ Rust で OS カーネルを書くには、基盤となる OS なしで動く実
|
|||||||
新しい Cargo プロジェクトをつくるところから始めましょう。もっとも簡単なやり方はコマンドラインで以下を実行することです。
|
新しい Cargo プロジェクトをつくるところから始めましょう。もっとも簡単なやり方はコマンドラインで以下を実行することです。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
プロジェクト名を `blog_os` としましたが、もちろんお好きな名前をつけていただいても大丈夫です。`--bin`フラグは実行可能バイナリを作成することを、 `--edition 2018` は[2018エディション][2018 edition]を使用することを明示的に指定します。コマンドを実行すると、 Cargoは以下のようなディレクトリ構造を作成します:
|
プロジェクト名を `blog_os` としましたが、もちろんお好きな名前をつけていただいても大丈夫です。`--bin`フラグは実行可能バイナリを作成することを、 `--edition 2024` は[2024エディション][2024 edition]を使用することを明示的に指定します。コマンドを実行すると、 Cargoは以下のようなディレクトリ構造を作成します:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -58,13 +58,13 @@ Rust로 운영체제 커널을 작성하려면, 운영체제 없이도 실행가
|
|||||||
제일 먼저 아래의 명령어를 통해 새로운 cargo 애플리케이션 크레이트를 만듭니다.
|
제일 먼저 아래의 명령어를 통해 새로운 cargo 애플리케이션 크레이트를 만듭니다.
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
프로젝트 이름은 `blog_os` 또는 원하시는 이름으로 정해주세요. `--bin` 인자는 우리가 cargo에게 실행 파일 (라이브러리와 대조됨)을 만들겠다고 알려주고, `--edition 2018` 인자는 cargo에게 우리가 [Rust 2018 에디션][2018 edition]을 사용할 것이라고 알려줍니다.
|
프로젝트 이름은 `blog_os` 또는 원하시는 이름으로 정해주세요. `--bin` 인자는 우리가 cargo에게 실행 파일 (라이브러리와 대조됨)을 만들겠다고 알려주고, `--edition 2024` 인자는 cargo에게 우리가 [Rust 2024 에디션][2024 edition]을 사용할 것이라고 알려줍니다.
|
||||||
위 명령어를 실행하고 나면, cargo가 아래와 같은 크레이트 디렉토리를 만들어줍니다.
|
위 명령어를 실행하고 나면, cargo가 아래와 같은 크레이트 디렉토리를 만들어줍니다.
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -55,12 +55,12 @@ By default, all Rust crates link the [standard library], which depends on the op
|
|||||||
We start by creating a new cargo application project. The easiest way to do this is through the command line:
|
We start by creating a new cargo application project. The easiest way to do this is through the command line:
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
I named the project `blog_os`, but of course you can choose your own name. The `--bin` flag specifies that we want to create an executable binary (in contrast to a library) and the `--edition 2018` flag specifies that we want to use the [2018 edition] of Rust for our crate. When we run the command, cargo creates the following directory structure for us:
|
I named the project `blog_os`, but of course you can choose your own name. The `--bin` flag specifies that we want to create an executable binary (in contrast to a library) and the `--edition 2024` flag specifies that we want to use the [2024 edition] of Rust for our crate. When we run the command, cargo creates the following directory structure for us:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ translators = ["MrZloHex"]
|
|||||||
Мы начнем с создания нового проекта cargo. Самый простой способ сделать это — через командную строку:
|
Мы начнем с создания нового проекта cargo. Самый простой способ сделать это — через командную строку:
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin -- edition 2018
|
cargo new blog_os --bin -- edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
Я назвал этот проект `blog_os`, но вы можете назвать как вам угодно. Флаг `--bin` указывает на то, что мы хотим создать исполняемый файл (а не библиотеку), а флаг `--edition 2018` указывает, что мы хотим использовать [редакцию Rust 2018][edition] для нашего крейта. После выполнения команды cargo создаст каталог со следующей структурой:
|
Я назвал этот проект `blog_os`, но вы можете назвать как вам угодно. Флаг `--bin` указывает на то, что мы хотим создать исполняемый файл (а не библиотеку), а флаг `--edition 2024` указывает, что мы хотим использовать [редакцию Rust 2024][edition] для нашего крейта. После выполнения команды cargo создаст каталог со следующей структурой:
|
||||||
|
|
||||||
[edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ translation_contributors = ["JiangengDong"]
|
|||||||
我们可以从创建一个新的 cargo 项目开始。最简单的办法是使用下面的命令:
|
我们可以从创建一个新的 cargo 项目开始。最简单的办法是使用下面的命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
在这里我把项目命名为 `blog_os`,当然读者也可以选择自己的项目名称。默认情况下,即使不显式指定,cargo 也会为我们添加`--bin` 选项,说明我们将要创建一个可执行文件(而不是一个库); 另外 `--edition 2018` 参数指明了项目的包要使用 Rust 的 **2018 版次**([2018 edition]),但在默认情况下,该参数会指向本地安装的最新版本。当我们成功执行这行指令后,cargo 为我们创建的目录结构如下:
|
在这里我把项目命名为 `blog_os`,当然读者也可以选择自己的项目名称。默认情况下,即使不显式指定,cargo 也会为我们添加`--bin` 选项,说明我们将要创建一个可执行文件(而不是一个库); 另外 `--edition 2024` 参数指明了项目的包要使用 Rust 的 **2024 版次**([2024 edition]),但在默认情况下,该参数会指向本地安装的最新版本。当我们成功执行这行指令后,cargo 为我们创建的目录结构如下:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
@@ -58,12 +58,12 @@ Rust 所有的 crate 在預設情況下都會連結[標準函式庫][standard li
|
|||||||
我們先從建立一個新的 cargo 專案開始,最簡單的辦法是輸入下面的命令:
|
我們先從建立一個新的 cargo 專案開始,最簡單的辦法是輸入下面的命令:
|
||||||
|
|
||||||
```
|
```
|
||||||
cargo new blog_os --bin --edition 2018
|
cargo new blog_os --bin --edition 2024
|
||||||
```
|
```
|
||||||
|
|
||||||
我將專案命名為 `blog_os`,當然讀者也可以自己的名稱。`--bin` 選項說明我們將要建立一個執行檔(而不是一個函式庫),`--edition 2018` 選項指明我們的 crate 想使用 Rust [2018 版本][2018 edition]。當我們執行這行指令的時候,cargo 會為我們建立以下目錄結構:
|
我將專案命名為 `blog_os`,當然讀者也可以自己的名稱。`--bin` 選項說明我們將要建立一個執行檔(而不是一個函式庫),`--edition 2024` 選項指明我們的 crate 想使用 Rust [2024 版本][2024 edition]。當我們執行這行指令的時候,cargo 會為我們建立以下目錄結構:
|
||||||
|
|
||||||
[2018 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/index.html
|
[2024 edition]: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html
|
||||||
|
|
||||||
```
|
```
|
||||||
blog_os
|
blog_os
|
||||||
|
|||||||
Reference in New Issue
Block a user