Rust 语言是一种高效、可靠的通用高级语言。其高效不仅限于开发效率,它的执行效率也是令人称赞的,是一种少有的兼顾开发效率和执行效率的语言。
Rust 语言由 Mozilla 开发,最早发布于 2014 年 9 月。Rust 的编译器是在 MIT License 和 Apache License 2.0 双重协议声明下的免费开源软件。截至目前( 2020 年 1 月)最新的编译器版本是 1.41.0。
actually I am a Java | Vue developer , but gradually I do not settle for make softwares , I wanna make some build tools.And I am satisfied with Rust’s advantages!
Rust docs is very particular,we can install it very easy!if you download correctly, you can even not to configure env variables!
https://www.rust-lang.org/zh-CN/tools/install
rustc --version
we can use rustup docs --books
to get the book in your local !
or you can get the translation version from here
first we should find what we need in GitHub and download zip
then unzip the package
install vuepress
npm i -g vuepress
npm i -g vue-template-compiler
build the src
vuepress build ./src
open the serve
vuepress dev ./src
vuepress may install slowly , so you should have so patience
we use VSCode as our ‘IDEA’ ,and we need to download these extenions
I make a HelloWorld.rs
fn:function
main():like java,c,c++…,the main function,which is the enter of the programe,and it always run first!
println!:focus ! it mean that is a rust macro
fn main(){
println!("hello world!")
}
rustc ./HelloWorld.rs
./HelloWorld.exe
Cargo is Rust’s build system and package manager. Most Rustaceans use Cargo to manage their Rust projects because it can handle many tasks for you, such as building code, downloading dependency libraries, and compiling these libraries
cargo --version
cargo new test_cargo
you will see a project which build by cargo
[package]
name = "test_cargo"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
cargo build
after compiler you can find a target package
./target/debug/test_cargo.exe