Name: Rust
First appearing in 2010, Rust was designed by Graydon Hoare at Mozilla Research, with contributions from Dave Herman, Brendan Eich, and others.
Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency. Rust is syntactically similar to C++, but can guarantee memory safety. Rust has been called a systems programming language and in addition to high-level features such as functional programming it also offers mechanisms for low-level memory management.
- Performance: Rust is blazingly fast and memory-efficient: with no runtime or garbage collector, it can power performance-critical services, run on embedded devices, and easily integrate with other languages.
- Reliability: Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — enabling you to eliminate many classes of bugs at compile-time.
- Productivity: Rust has great documentation, a friendly compiler with useful error messages, and top-notch tooling — an integrated package manager and build tool, smart multi-editor support with auto-completion and type inspections, an auto-formatter, and more.
Rust has been adopted by major software engineering companies. Rust is used for:
- Web browsers and services: Firefox, OpenDNS, Deno, Figma,...
- Operating systems: Redox, Theseus, Google Fuchia, Stratis,...
- Other notable projects and platforms: Discord, Microsoft Azure, Amazon Web Services, Polkadot (cryptocurrency),...
Note: What I like most about rust programming language is its popularity in Dapps(Decentralize Applications) programming. I plan to program blockchain applications.
- Pages:
- Basic
- Domain Specific
- Advance
- Hands On Practice
- Course: Rustling course
- Dapps Developers: Ethereum, Solana, Polkadot, Near,...
- Blog: educative.io
- Youtube: dcode, Traversy Media, Blockchain cùng Vũ, Jon Gjenset,
- rustc: The complier which takes your Rust code and compiles it into binary (machine readable code)
- rustup: The command line utility to install and update Rust
- cargo: The Rust build system and package manager
- Install Programing Enviroment: Visual Studio C++ Build tools
- Install Rust
- Install Intellij IDEA and Intellij Rust Plugin
-
Create new project: Go to File | New | Project (File | New Project) or click New project on the welcome screen.
-
Select Rust from the list in the left-hand pane.
-
Choose the template to used, specify the project name, location, and toolchain parameters:
-
Click Create when ready, and the IDE will generate a ready-to-go stub project:
Comments in Rust code follow the general C++ style of line (//
) and block (/* ... */
) comment forms. Nested block comments are supported.
Non-doc comments are interpreted as a form of whitespace.
Line doc comments beginning with exactly three slashes (///
), and block doc comments (/** ... */
), both inner doc comments, are interpreted as a special syntax for doc
attributes. That is, they are equivalent to writing #[doc="..."]
around the body of the comment, i.e., /// Foo turns into #[doc="Foo"]
and /** Bar */
turns into #[doc="Bar"]
.
Line comments beginning with //!
and block comments /*! ... */
are doc comments that apply to the parent of the comment, rather than the item that follows. That is, they are equivalent to writing #![doc="..."]
around the body of the comment. //!
comments are usually used to document modules that occupy a source file.
Isolated CRs (\r
), i.e. not followed by LF (\n
), are not allowed in doc comments.
#![allow(unused_variables)]
fn main() {
//! A doc comment that applies to the implicit anonymous module of this crate
pub mod outer_module {
//! - Inner line doc
//!! - Still an inner line doc (but with a bang at the beginning)
/*! - Inner block doc */
/*!! - Still an inner block doc (but with a bang at the beginning) */
// - Only a comment
/// - Outer line doc (exactly 3 slashes)
//// - Only a comment
/* - Only a comment */
/** - Outer block doc (exactly) 2 asterisks */
/*** - Only a comment */
pub mod inner_module {}
pub mod nested_comments {
/* In Rust /* we can /* nest comments */ */ */
// All three types of block comments can contain or be nested inside
// any other type:
/* /* */ /** */ /*! */ */
/*! /* */ /** */ /*! */ */
/** /* */ /** */ /*! */ */
pub mod dummy_item {}
}
pub mod degenerate_cases {
// empty inner line doc
//!
// empty inner block doc
/*!*/
// empty line comment
//
// empty outer line doc
///
// empty block comment
/**/
pub mod dummy_item {}
// empty 2-asterisk block isn't a doc block, it is a block comment
/***/
}
/* The next one isn't allowed because outer doc comments
require an item that will receive the doc */
/// Where is my item?
mod boo {}
}