rust基本语法.md

Rust 语言概述

基本数据类型

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# integer
# i8 i16 i32 i64 i128
# u8 u16 u32 u64 u128
let x : i8 = 2;

# f32 f64
let y : f64 = 2.0;

# true false
let z : bool = true;

# tup
let tup = (1, 2, 3);
let tup_a : (i32, f64, u8) = (500, 1.0, 2);

#

输入输出

1
2
3
4
5
# print!
println!("{}", output);

# format!
let command = format!("clang -Xclang -ast-dump -fsyntax-only {}", f_path.to_string());

函数

函数定义

1
2
3
4
5
6
7
8
9
fn func() {
// logic
}

fn func(a: i8, b: i8) {
// param need type statement
}

fn func(a: int)

rust基本语法.md
https://abrance.github.io/2024/02/28/mdstorage/project/cToRust/rust基本语法/
Author
xiaoy
Posted on
February 28, 2024
Licensed under