摘要:
创建Mutex实例 use std::sync::Mutex; fn main() { let m = Mutex::new(5); println!("m = {:?}", m); } m = Mutex { data: 5, poisoned: false, .. } 访问数据 get_mut 阅读全文
posted @ 2026-04-14 21:58
lxd670
阅读(16)
评论(0)
推荐(0)
摘要:
hashset说明 天然去除重复元素 创建和初始化 new use std::collections::HashSet; fn main() { let mut set = HashSet::new(); } 查看容量和长度 use std::collections::HashSet; fn mai 阅读全文
posted @ 2026-04-14 02:09
lxd670
阅读(5)
评论(0)
推荐(0)
摘要:
hashmap hashmap是一个无序的字典 创建hashmap new 创建空的hashmap use std::collections::HashMap; fn main() { // let mut map = HashMap::<String, i32>::new(); let mut m 阅读全文
posted @ 2026-04-14 02:09
lxd670
阅读(8)
评论(0)
推荐(0)
摘要:
Cursor Cursor把内存数据 &[u8] → 变成可读写、可seek的虚拟文件(模拟文件、网络读写) new 创建一个新的游标来包装所提供的底层内存缓冲区 use std::io::Cursor; fn main() { // 1. 从 Vec<u8> 创建 let cursor1 = Cu 阅读全文
posted @ 2026-04-14 02:08
lxd670
阅读(8)
评论(0)
推荐(0)

浙公网安备 33010602011771号