当前位置:网站首页>03.hello_rust
03.hello_rust
2022-06-28 19:52:00 【用户6532403】
第一个Rust程序。
- 先创建一个目录 hello_rust。
- 可以使用趁手的编辑(jetbrains系列可以安装rust插件,或者是vscode的rust插件都可以)。
- 创建rust源代码文件,它是用 .rs 作为扩展名的。
- 在hello.rs中,输入
fn main(){
println!("Hello Rust!")
}fn - Rust 语言使用 fn 关键字定义函数。main() 函数是一个预定义的主函数,充当 Rust 程序的入口点,每个语言都会有自己的 main() 函数。 println!() 是 Rust 语言中的一个 预定义的宏。它用于将传递给它的参数输出到 标准输出。
注:Rust 语言中的 宏 都会以 感叹号 ( ! ) 结尾。以后看到以 ! 结尾的类似函数调用,都是 宏调用。Rust 提供了一个功能非常强大的 宏 体系,通过这些 宏,我们可以很方便的进行 元编程。Rust 中的 宏 有点类似于 函数。可以将 宏 理解为 函数的加强版。
使用 rustc hello.rs,编译出一个以hello为名字的二进制的可执行文件
运行 ./hello,屏幕输出 Hello Rust!
边栏推荐
- jsp中获取session中的值
- 2837. The total number of teams
- 2022年4月10日--使用C#迈出第一步--使用C#从.NET类库调用方法(没看懂)
- Can layoffs really save China's Internet?
- The white paper on the panorama of the digital economy and the digitalization of consumer finance were released
- Kaggle肠胃道图像分割比赛baseline
- rsync远程同步
- Average score of 100 people
- H5 sunflower operation
- two thousand three hundred and forty-two
猜你喜欢

Time series forecasting based on trend and seasonality

为什么C语言用使用其他文件的结构体变量时,声明结构体别名还不行,必须使用本名?(使用别名时不能加struct)

h5向日葵作业

Figure introduction to neural networks (GNN, GCN)

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C1047 对象或库文件“.lib”是使用与其他对象(如“x64\Release\main.obj”)不同的

数字经济专家高泽龙:映客更名映宇宙,元宇宙会成为映客下一个增长引擎吗?

Leetcode week 299

Intelligent computing system 1 environment construction

【算法篇】刷了两道大厂面试题,含泪 ”重学数组“

Demo of intelligent computing system 2 bangc operator development (heterogeneous programming flow of CPU and mlu270)
随机推荐
csdn涨薪技术-Selenium自动化测试全栈总结
Leetcode week 299
Intelligent computing system 1 environment construction
return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};
easypoi
【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
TcWind 模式設定
数字经济专家高泽龙:映客更名映宇宙,元宇宙会成为映客下一个增长引擎吗?
Figure introduction to neural networks (GNN, GCN)
522. 最长特殊序列 II(贪心&双指针)
压缩与解压缩命令
如何获取飞机穿过雷达两端的坐标
Software supply chain security risk guide for enterprise digitalization and it executives
R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
Windows 64 bit download install my SQL
Bayesian inference problem, MCMC and variational inference
MDM data analysis function description
2280.Cupboards
2837. The total number of teams
Fontawesome icon for color gradient