04 2023 档案

摘要:一、线程间通信方式: channel 1 use std::sync::mpsc; 2 use std::thread; 3 4 fn main() { 5 let (tx, rx) = mpsc::channel(); 6 7 thread::spawn(move || { 8 let val = 阅读全文
posted @ 2023-04-04 20:25 朝花不夕拾 阅读(103) 评论(0) 推荐(0) 编辑
摘要:rust中智能指针大致分类 以下内容提炼自rust官方文档: https://doc.rust-lang.org/book/ch15-01-box.html 一、 Box<T> 1. 使用例子: 1 fn main() { 2 let b = Box::new(5); 3 println!("b = 阅读全文
posted @ 2023-04-04 20:19 朝花不夕拾 阅读(81) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示