上一页 1 2 3 4 5 6 7 8 9 ··· 68 下一页
摘要: title: rust scoped thread pool date: 2021-08-09 16:53:11 用rayon即可。 mod a { fn fun(a: &mut i32) -> i32 { *a += 1; return *a + 233; } pub fn main() { le 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(31) 评论(0) 推荐(0)
摘要: title: 算法竞赛中rust的一种比较健壮的读入 date: 2020-08-25 23:53:13 tags: 以PAT 甲级1004为例:https://pintia.cn/problem-sets/994805342720868352/exam/problems/9948055214317 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(42) 评论(0) 推荐(0)
摘要: title: rust识别EOF date: 2020-08-17 16:45:54 tags: 参考:https://stackoverflow.com/questions/41210691/how-to-check-for-eof-in-read-line-in-rust-1-12 如果read 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(41) 评论(0) 推荐(0)
摘要: title: rust用BufReader加速stdin读取 date: 2021-11-17 17:30:21 tags: BufReader官方文档:https://doc.rust-lang.org/stable/std/io/struct.BufReader.html use std::io 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(54) 评论(0) 推荐(0)
摘要: title: rust格式控制 date: 2021-10-12 20:59:05 官方教程:https://doc.rust-lang.org/std/fmt/ 注意,标准库里的格式控制字符串必须是字面量: https://www.reddit.com/r/rust/comments/48jzw0 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(30) 评论(0) 推荐(0)
摘要: title: rust格式化打印到文件 date: 2021-07-05 09:58:41 用write!和writeln!即可。 write!(&mut writer, "Factorial of {} = {}", num, factorial); writeln!就是在最后自动加一个换行。 原 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(27) 评论(0) 推荐(0)
摘要: title: rust单行读取多个整数 date: 2020-08-15 10:49:13 tags: rust读取真的很麻烦。网上的方法一般是用split(' ')来分割出整数。但是如果中间有多个空格就凉了。后面查阅官方文档发现了split_whitespace,可以用多个空白字符(空格和tab, 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(82) 评论(0) 推荐(0)
摘要: title: rust从一行中读取数组 date: 2020-08-26 13:50:41 tags: use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).unwrap() 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(26) 评论(0) 推荐(0)
摘要: title: rust BufReader逐字符读取 date: 2021-12-03 20:05:20 tags: BufReader有一个fill_buf的方法: fn fill_buf(&mut self) -> Result<&[u8]> 它可以返回它的内部buffer,如果buffer是空 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(121) 评论(0) 推荐(0)
摘要: title: rust print固定宽度左边补零 date: 2020-08-25 19:34:43 tags: 参考:https://doc.rust-lang.org/std/fmt/ 任意类型 fn main() { println!("{:0>3}", 2333); println!("{ 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(57) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 68 下一页