rust
stewie9
这个作者很懒,什么都没留下…
展开
-
rustのownership
Ownership是rust最有特点的功能。它让rust无须垃圾回收机制就可以保证内存安全。因此,了解所有权在Rust中的工作方式非常重要。本章关于Ownership主要讨论 borrowing, slicing和Rust如何组织数据存储。 导入:rust的ownership是什么 所有程序必须要做好运行时的内存管理。有些语言有垃圾回收功能,该埃及回收功能在程序运行时不断寻找不再使用的内存。还有的...原创 2019-12-30 15:57:10 · 174 阅读 · 0 评论 -
rustの常见编程概念:变量和可变性
1. 默认变量是不可变值的变量: let x = 5; println!(x); x = 8;// not allowed! Would cause error while compiling because x is immutable let mut y = 10; println!(y); y = 11; println!(y);//that's ok. 注意,虽然无法更改变量的值,这也不...原创 2019-12-30 15:55:21 · 182 阅读 · 0 评论