当前位置:网站首页>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!
边栏推荐
- 《数据安全法》出台一周年,看哪四大变化来袭?
- ArrayList of collection
- Grep text search tool
- Digital collection, ten thousand words long text, most of the questions you want to know have been clearly explained, which must be seen by practitioners
- 如何获取飞机穿过雷达两端的坐标
- April 10, 2022 -- take the first step with C -- use C from Net class library call method (not understood)
- 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C1047 对象或库文件“.lib”是使用与其他对象(如“x64\Release\main.obj”)不同的
- TcWind 模式設定
- 集合之ArrayList
- Wechat applet_ 8. View and logic
猜你喜欢

5G NR MBS架构介绍

Markdown mermaid种草(1)_ mermaid简介

echart:横向柱状图的类目文字位置调整

easypoi

30讲 线性代数 第四讲 线性方程组

Day88. qiniu cloud: upload house source pictures and user avatars

Echart: category text position adjustment of horizontal histogram

Intelligent computing system 1 environment construction

Nanopc-t4 (rk3399) Game1 OLED (I2C) display time weather temperature

2022年T电梯修理考试题库模拟考试平台操作
随机推荐
2022 t elevator repair test question bank simulation test platform operation
【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
微信小程序_8,视图与逻辑
Rsync remote synchronization
[go language questions] go from 0 to entry 5: comprehensive review of map, conditional sentences and circular sentences
类加载机制与对象的创建
数论 --- 欧拉函数、筛法求欧拉函数、欧拉定理、费马小定理详细证明
QSP读取标签配置错误问题
Markdown mermaid种草(1)_ mermaid简介
Bayesian inference problem, MCMC and variational inference
2022年T电梯修理考试题库模拟考试平台操作
Digital collection, ten thousand words long text, most of the questions you want to know have been clearly explained, which must be seen by practitioners
集合之ArrayList
Server configuration estimation of core IOT Bluetooth AOA positioning system
2022年P气瓶充装考试练习题及在线模拟考试
Intelligent computing system 1 environment construction
Markdown Mermaid planting grass (1)_ Introduction to Mermaid
JVM memory structure
Kettle (VI): full database backup based on kettle
wc命令的使用