当前位置:网站首页>[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 .
边栏推荐
- VMware virtual machine and vSphere migrate to each other
- Dynamic memory management
- NFT digital collection system construction - app development
- JMeter while controller
- Remember to optimize my personal blog once
- 安装jmeter
- [I also want to brush through leetcode] 468. Verify the IP address
- Database operation through shell script
- CCF 1-2 question answering record (2)
- Hash - 242. valid alphabetic ectopic words
猜你喜欢

三、MFC消息映射机制实现原理

Svn server and client installation (Chinese package) and simple use

【网络空间安全数学基础第9章】有限域

String -- 344. Reverse string
What is cloud native? Why is cloud native technology so popular?
![[mathematical basis of Cyberspace Security Chapter 9] finite field](/img/2b/27ba1f3c6ec2ecff4538f9a63a79e8.jpg)
[mathematical basis of Cyberspace Security Chapter 9] finite field

L1-059 ring stupid bell
![[markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)](/img/a5/c92e0404c6a970a62595bc7a3b68cd.gif)
[markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)

Linked list - 142. Ring linked list II

在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制
随机推荐
Understand the storage and retrieval of data
Hash - 15. Sum of three numbers
Hash - 242. valid alphabetic ectopic words
栈顶与栈底
Detailed explanation of stat function
哈希——349. 两个数组的交集
Top and bottom of stack
Mysql database
Two important laws about parallelism
6k+ star, a deep learning code base for Xiaobai! One line of code implements all attention mechanisms!
Makefile quick use
Share the typora tool
GCC的基本用法
第0章 前言和环境配置
Shell script "< < EOF" my purpose and problems
6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
Please ask whether Oracle CDC does not support checkpointing. When the task is suspended and restarted during the real-time collection process, is the data changed
In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
Time processing of basic library in go
The difference between where and having