通过例子学习Rust之 1 Hello World
2015-06-25 17:25
375 查看
1 Hello World
世界,你好。
This is the source code of the traditional Hello World program.
这是传统的Hello World的源代码。
println! is a macro that prints text to the console.
println! 是一个向控制台打印文本的宏
A binary can be generated using the Rust compiler: rustc.
使用Rust编译器命令rustc即可生成二进制文件
$ rustc hello.rs
rustc will produce a hello binary that can be executed.
rustc 将产生一个可执行的二进制文件hello
$ ./hello
Hello World!
世界,你好。
This is the source code of the traditional Hello World program.
这是传统的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 -> // 点击Run按钮即可运行此代码 // or if prefer to use your keyboard, you can use the "Ctrl + Enter" shortcut // 或者希望使用键盘,可以用"Ctrl + Enter"快捷键 // This code is editable, feel free to hack it! // 点击此代码即可编辑 // You can always return to the original code by clicking the "Reset" button -> // 随时点击"Reset"按钮回到初始代码 // This is the main function // 这是主函数 fn main() { // The statements here will be executed when the compiled binary is called // Print text to the console println!("Hello World!"); }
println! is a macro that prints text to the console.
println! 是一个向控制台打印文本的宏
A binary can be generated using the Rust compiler: rustc.
使用Rust编译器命令rustc即可生成二进制文件
$ rustc hello.rs
rustc will produce a hello binary that can be executed.
rustc 将产生一个可执行的二进制文件hello
$ ./hello
Hello World!
相关文章推荐
- C#学习进阶Hello World的17种写法代码分享
- Android 初识 Helloworld 详解
- Cocos2d-x学习入门之HelloWorld程序
- C语言之没有main函数的helloworld示例
- java 学习笔记(入门篇)_java程序helloWorld
- Git之`Hello, World`
- Linux驱动开发___helloWorld模块编译
- HelloWorld App of ffmpeg JNI
- jfinal-hello world
- Rust 与开发环境的安装与设置(Windows篇)
- javaWeb Servlet的helloworld
- 在CMD下用java命令出现“找不到或无法加载主类”问题
- java转cocos2d-x:Helloworld
- 编译Rust for arm
- 使用Rust交叉编译arm程序
- 自学Java容易遇到的一个问题
- HelloWorld 大全
- Android环境搭建
- cocos2dx搭建开发环境
- Hibernate 总结(一):HelloWorld