当前位置:网站首页>[rust] Why do I suggest you learn rust | a preliminary study of rust
[rust] Why do I suggest you learn rust | a preliminary study of rust
2022-07-24 12:02:00 【Light rain youth】
List of articles
One 、Rust Characteristics
Rust It's a multi paradigm 、 Universal programming language , Designed to improve performance and security , Especially security concurrency . Rust Grammatically similar to C++, But you can use the borrowing checker to verify references to ensure memory security . Rust Memory security without garbage collection , And the reference count is optional . Rust It is called system programming language , In addition to advanced features such as functional programming , It also provides a low-level memory management mechanism .
Rust First appeared in 2010 year , from Mozilla Research Of Graydon Hoare Design ,Dave Herman、Brendan Eich Others have also made contributions . The designer is writing Servo Experimental browser engine and Rust The compiler improves the language . Rust The main impacts include C++、OCaml、Haskell and Erlang. It has gained more and more use and investment in the industry , Including Amazon 、 Microsoft 、Facebook、Discord and Dropbox.
Rust The language aims to develop reliable and robust systems in a simple way . Rust It can be used to repair advanced software and hardware specific programs .
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-VbrHVu2n-1658198463175)(https://cdn.metalyoung.com/2022/07/1658198391278.svg)]
Two 、 Quickly understand
1. Installation environment
MacOS Lower installation Rust It's simple .
curl https://sh.rustup.rs -sSf | sh
info: downloading installer
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/Users/xiaoyu/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
/Users/xiaoyu/.cargo
This can be modified with the CARGO_HOME environment variable.
The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:
/Users/xiaoyu/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/Users/xiaoyu/.profile
/Users/xiaoyu/.bash_profile
/Users/xiaoyu/.zshenv
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-apple-darwin
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
What we can get from the above is :
- The official package manager is Cargo
- rust The installation path of is /Users/xiaoyu/.cargo/bin
- The script will automatically add environment variables to the configuration file
After a period of downloading , Finally, the installation is completed .
stable-x86_64-apple-darwin installed - rustc 1.62.0 (a8314ef7d 2022-06-27)
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source "$HOME/.cargo/env"
2. View version
~ % rustc --version
rustc 1.62.0 (a8314ef7d 2022-06-27)
at present rust The version is 1.62.0
3. Hello World
Create a new file named HelloWorld.rs, The contents are as follows
fn main(){
println!("Hello World !!");
}
main Function is the entrance of the whole application ,fn This method is even better than go Of func shorter .
perform rustc HelloWorld.rs, Compile the program . stay MacOS Under the environment of , We can get one HelloWorld The executable of .

Execute this file , We can see the output .
rust % ./HelloWorld
Hello World !!
therefore ,Rust The application needs to be compiled , and Java 、Go It's the same , The difference in Python 、PHP .
3、 ... and 、 summary
Rust Compilation and execution are required , It's characterized by safety 、 Fast 、 Support concurrency .
边栏推荐
- Hash - 15. Sum of three numbers
- Hash - 349. Intersection of two arrays
- 20000 words detailed explanation, thoroughly understand es!
- VMware virtual machine and vSphere migrate to each other
- Chapter 1 Introduction
- Jackson parsing JSON detailed tutorial
- Difference between GCC -l parameter and -l parameter
- 字符串——541. 反转字符串 II
- Understand the storage and retrieval of data
- Use and expansion of fault tolerance and fusing
猜你喜欢

20000 words detailed explanation, thoroughly understand es!

链表——142. 环形链表 II

One week's wonderful content sharing (issue 13)

What is prescaler in STM32
![[mathematical basis of Cyberspace Security Chapter 9] finite field](/img/2b/27ba1f3c6ec2ecff4538f9a63a79e8.jpg)
[mathematical basis of Cyberspace Security Chapter 9] finite field

源码分析Sentry用户行为记录实现过程

Leetcode:51. queen n

6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
What is cloud native? Why is cloud native technology so popular?
![Operational amplifier - Notes on rapid recovery [1] (parameters)](/img/1f/37c5548ce84b6a217b4742431f1cc4.png)
Operational amplifier - Notes on rapid recovery [1] (parameters)
随机推荐
Is there any charge for PDF processing? impossible!
Linked list - Sword finger offer interview question 02.07. linked list intersection
Day3: branch structure
Easy to understand ES6 (IV): template string
容错、熔断的使用与扩展
[TA frost wolf umay - "hundred people plan] Figure 3.3 surface subdivision and geometric shader large-scale grass rendering
Makefile quick use
L1-043 阅览室
Optimization method of "great mathematics for use" -- optimal design of Cascade Reservoir Irrigation
在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制
[data mining engineer - written examination] sheen company in 2022
MySQL advanced (XVII) cannot connect to database server problem analysis
CCF 1-2 question answering record (2)
L1-064 估值一亿的AI核心代码
Experience of redis deepwater area -- Interview reference
C#入门系列(二十九) -- 预处理命令
Time processing of basic library in go
Markdown mathematical formula syntax
Use of multithreading in QT
Basic usage of GCC