摘要: /// /// https://kaisery.github.io/trpl-zh-cn/ch04-01-what-is-ownership.html fn main() { let mut s = String::from("hello"); s.push_str(",world!"); prin 阅读全文
posted @ 2024-04-15 11:18 ukyo--BlackJesus 阅读(3) 评论(0) 推荐(0) 编辑
摘要: /// /// https://kaisery.github.io/trpl-zh-cn/ch04-02-references-and-borrowing.html fn main() { let mut s = String::from("hello"); let r1 = &s; //没问题 l 阅读全文
posted @ 2024-04-15 10:32 ukyo--BlackJesus 阅读(2) 评论(0) 推荐(0) 编辑
摘要: /// https://kaisery.github.io/trpl-zh-cn/ch03-05-control-flow.html /// 控制流 fn main() { println!("Hello, world!"); let number = 3; println!("First numb 阅读全文
posted @ 2024-04-15 10:27 ukyo--BlackJesus 阅读(1) 评论(0) 推荐(0) 编辑
摘要: /** 函数体由一系列的语句和一个可选的结尾表达式构成.目前为止,我们提到的函数还不包含结尾表达式, 不过作为语句一部分的表达式有一些.因为Rust是一门基于表达式(expression-based)的语言, 这是一个需要理解的(不同于其他语言)重要区别. */ fn main() { printl 阅读全文
posted @ 2024-04-15 09:49 ukyo--BlackJesus 阅读(1) 评论(0) 推荐(0) 编辑
摘要: fn main() { println!("Hello, world!"); another_function(); another_function2(5); print_labeled_measurement(5,'h'); } fn another_function(){ println!(" 阅读全文
posted @ 2024-04-15 09:04 ukyo--BlackJesus 阅读(1) 评论(0) 推荐(0) 编辑
摘要: //https://kaisery.github.io/trpl-zh-cn/ch03-02-data-types.html fn main() { println!("Hello, world!"); //标量(scalar)类型代表一个单独的值。Rust 有四种基本的标量类型:整型、浮点型、布尔 阅读全文
posted @ 2024-04-15 08:52 ukyo--BlackJesus 阅读(2) 评论(0) 推荐(0) 编辑