rust

来源:互联网 发布:沙发 知乎 编辑:程序博客网 时间:2024/04/30 15:53
根据百度百科的解释:Rust是Mozilla开发的注重安全、性能和并发性的编程语言。rust官网:https://www.rust-lang.org/

1. 安装
从官网下载安装包,我这里下载的安装包名字是:rust-1.6.0-x86_64-unknown-linux-gnu.tar.gz

然后解压,进入rust目录,根据README提示,执行sudo ./install.sh命令来安装rust。

2. hello
hello world源码:
// This is a comment, and will be ignored by the compiler// You can test this code by clicking the "Run" button over there ->// or if prefer to use your keyboard, you can use the "Ctrl + Enter" shortcut// This code is editable, feel free to hack it!// You can always return to the original code by clicking the "Reset" button ->// This is the main functionfn main() {    // The statements here will be executed when the compiled binary is called    // Print text to the console    println!("Hello World!");}

然后编译,编译使用rustc命令:
rustc hello.rs

运行:
$ ./hello
Hello World!

参考:http://rustbyexample.com/hello.html
0 0