当前位置:网站首页>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!
边栏推荐
- 社招两年半10个公司28轮面试面经
- wc命令的使用
- 2837. The total number of teams
- Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature
- C language - function knowledge points
- redisTemplate
- 1002_ twenty million one hundred and eighty-one thousand and nineteen
- jvm内存结构
- Analysis of all knowledge points of TCP protocol in network planning
- 秒杀系统设计
猜你喜欢

30讲 线性代数 第四讲 线性方程组
![[324. swing sequence II]](/img/4f/dbbc28c7c13ff94bd0956f2ccf9603.png)
[324. swing sequence II]

Gaozelong, a digital economy expert: Yingke changed its name to yingcosmos. Will yuancosmos become the next growth engine of Yingke?

Why is it not enough to declare the structure alias when using the structure variable of other files in C language, and the proper name must be used? (cannot add struct when using alias)

计网 | 一文解析TCP协议所有知识点

28 rounds of interviews with 10 companies in two and a half years

H5 sunflower operation

Variable autoencoders (vaes)

Are you still paying for your thesis? Come and join me

h5向日葵作业
随机推荐
Use of WC command
Judge whether the string is empty
Markdown Mermaid Grass (1) Introduction à Mermaid
Configuration du mode tcwind
2022焊工(初级)特种作业证考试题库及答案
h5向日葵作业
Software supply chain security risk guide for enterprise digitalization and it executives
还在付费下论文吗?快来跟我一起白piao知网
F (x) construct the equation, calculate the partial derivative by gradient descent, determine the partial derivative adjustment by loss function, and deal with nonlinear problems by activation functio
Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level
Double contextual relationship network for polyp segmentation
ROS中quaternion四元数和欧拉角转换
Kaggle肠胃道图像分割比赛baseline
2280.Cupboards
Kettle (VI): full database backup based on kettle
Troubleshooting of pyinstaller failed to pack pikepdf
Markdown mermaid種草(1)_ mermaid簡介
2022年P气瓶充装考试练习题及在线模拟考试
SQL server2019 create a new SQL server authentication user name and log in
[go language questions] go from 0 to entry 5: comprehensive review of map, conditional sentences and circular sentences