From 5a23d4d326c1ae3f44df3900f74b310f0eaaead7 Mon Sep 17 00:00:00 2001 From: Ruslan Semagin <53819609+pixel365@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:57:10 +0300 Subject: [PATCH] add links to the 'Modules and Crates' node in the Rust roadmap (#5797) --- .../103-modules-and-crates/100-code-organization.md | 7 ++++++- .../content/103-modules-and-crates/101-dependency-mgmt.md | 7 ++++++- .../rust/content/103-modules-and-crates/102-publishing.md | 8 ++++++-- .../roadmaps/rust/content/103-modules-and-crates/index.md | 6 +++++- src/data/roadmaps/rust/rust.json | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/data/roadmaps/rust/content/103-modules-and-crates/100-code-organization.md b/src/data/roadmaps/rust/content/103-modules-and-crates/100-code-organization.md index 0987a4aa7..eea645e20 100644 --- a/src/data/roadmaps/rust/content/103-modules-and-crates/100-code-organization.md +++ b/src/data/roadmaps/rust/content/103-modules-and-crates/100-code-organization.md @@ -1,3 +1,8 @@ # Code Organization and Namespacing -In Rust, the fundamental structure for organizing your code is through using a **module** system and **crates**. A module in Rust allows grouping of related function definitions and struct definitions in a named scope. It’s defined using the `mod` keyword. The modules can also be nested and make code more concise, readable, and manageable. On the other hand, a **crate** is a binary or a library project in Rust. It's the largest compilation unit of Rust. It's a tree of modules that produces a library or executable. The crate root is a source file which the Rust compiler starts from and makes up the root module of your crate (e.g. `main.rs` or `lib.rs`). \ No newline at end of file +In Rust, the fundamental structure for organizing your code is through using a **module** system and **crates**. A module in Rust allows grouping of related function definitions and struct definitions in a named scope. It’s defined using the `mod` keyword. The modules can also be nested and make code more concise, readable, and manageable. On the other hand, a **crate** is a binary or a library project in Rust. It's the largest compilation unit of Rust. It's a tree of modules that produces a library or executable. The crate root is a source file which the Rust compiler starts from and makes up the root module of your crate (e.g. `main.rs` or `lib.rs`). + +Visit the following resources to learn more: + +- [Rust by Example: Modules](https://doc.rust-lang.org/rust-by-example/mod.html) +- [The Rust Reference: Namespaces](https://doc.rust-lang.org/reference/names/namespaces.html) diff --git a/src/data/roadmaps/rust/content/103-modules-and-crates/101-dependency-mgmt.md b/src/data/roadmaps/rust/content/103-modules-and-crates/101-dependency-mgmt.md index 0f15c0738..14985f5d4 100644 --- a/src/data/roadmaps/rust/content/103-modules-and-crates/101-dependency-mgmt.md +++ b/src/data/roadmaps/rust/content/103-modules-and-crates/101-dependency-mgmt.md @@ -1,3 +1,8 @@ # Dependency Management with Cargo.toml -Dependency management in Rust is handled by a tool called Cargo. Cargo helps you manage your Rust projects, providing functionalities for building your code, downloading the libraries your project depends on, and building those libraries. These libraries are called *crates*. A crate is a package of Rust code. In your `Cargo.toml`, you list your dependencies in a [dependencies] section. You list libraries from crates.io by their name and version number. Cargo understands Semantic Versioning, a standard for writing version numbers. \ No newline at end of file +Dependency management in Rust is handled by a tool called Cargo. Cargo helps you manage your Rust projects, providing functionalities for building your code, downloading the libraries your project depends on, and building those libraries. These libraries are called _crates_. A crate is a package of Rust code. In your `Cargo.toml`, you list your dependencies in a [dependencies] section. You list libraries from crates.io by their name and version number. Cargo understands Semantic Versioning, a standard for writing version numbers. + +Visit the following resources to learn more: + +- [Rust Blog: Cargo](https://blog.rust-lang.org/2016/05/05/cargo-pillars.html) +- [Rust by Example: Dependencies](https://doc.rust-lang.org/rust-by-example/cargo/deps.html) diff --git a/src/data/roadmaps/rust/content/103-modules-and-crates/102-publishing.md b/src/data/roadmaps/rust/content/103-modules-and-crates/102-publishing.md index e173c98dd..cb568a090 100644 --- a/src/data/roadmaps/rust/content/103-modules-and-crates/102-publishing.md +++ b/src/data/roadmaps/rust/content/103-modules-and-crates/102-publishing.md @@ -1,3 +1,7 @@ -# Publishing to crates.io +# Publishing on crates.io -Publishing in Rust involves packaging up your library or executable and making it available for others to use. To publish a crate, you'll need to create an account on [crates.io](https://crates.io/), the Rust package repository. If you haven't already, you'll need to format your project in a specific way, detailing needed information in a `Cargo.toml` file. Then, use the command `cargo publish` to upload your crate to the registry. Updates to your crate can be published with the same command, but be mindful that crates.io does not allow you to delete or overwrite an existing version of a crate. Make sure that everything is in order before you publish! \ No newline at end of file +Publishing in Rust involves packaging up your library or executable and making it available for others to use. To publish a crate, you'll need to create an account on [crates.io](https://crates.io/), the Rust package repository. If you haven't already, you'll need to format your project in a specific way, detailing needed information in a `Cargo.toml` file. Then, use the command `cargo publish` to upload your crate to the registry. Updates to your crate can be published with the same command, but be mindful that crates.io does not allow you to delete or overwrite an existing version of a crate. Make sure that everything is in order before you publish! + +Visit the following resources to learn more: + +- [The Cargo Book: Publishing on crates.io](https://doc.rust-lang.org/cargo/reference/publishing.html) diff --git a/src/data/roadmaps/rust/content/103-modules-and-crates/index.md b/src/data/roadmaps/rust/content/103-modules-and-crates/index.md index 2b6db44dd..b65089361 100644 --- a/src/data/roadmaps/rust/content/103-modules-and-crates/index.md +++ b/src/data/roadmaps/rust/content/103-modules-and-crates/index.md @@ -1,3 +1,7 @@ # Modules and Crates -In Rust, a module is a namespace that contains definitions of functions or types. You can choose to make the definitions visible in other modules or not. This provides a method of encapsulation for your code. On the other hand, a crate is a binary or library. It is the smallest unit of compilation in Rust. A crate can link to other crates, and it is composed of many modules. Therefore, the module system allows for code organization within a crate, and the crate system allows for building and sharing functionality among multiple projects. \ No newline at end of file +In Rust, a module is a namespace that contains definitions of functions or types. You can choose to make the definitions visible in other modules or not. This provides a method of encapsulation for your code. On the other hand, a crate is a binary or library. It is the smallest unit of compilation in Rust. A crate can link to other crates, and it is composed of many modules. Therefore, the module system allows for code organization within a crate, and the crate system allows for building and sharing functionality among multiple projects. + +Visit the following resources to learn more: + +- [Rust Book: Managing Growing Projects with Packages, Crates, and Modules](https://doc.rust-lang.org/book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html) diff --git a/src/data/roadmaps/rust/rust.json b/src/data/roadmaps/rust/rust.json index 606ddbf8a..c4bd7d867 100644 --- a/src/data/roadmaps/rust/rust.json +++ b/src/data/roadmaps/rust/rust.json @@ -6229,7 +6229,7 @@ "y": "13", "properties": { "size": "17", - "text": "Publishing to crates.io" + "text": "Publishing on crates.io" } } ]