上一页 1 2 3 4 5 6 ··· 66 下一页
摘要: title: rust 堆上二维数组 date: 2021-09-15 16:56:00 用ndarray: https://docs.rs/ndarray/0.15.3/ndarray/ Rust 多维数组 ndarray 例子: use ndarray::Array2; fn main() { 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(8) 评论(0) 推荐(0) 编辑
摘要: title: rust serde deserialize borrowed member date: 2021-07-27 17:04:01 对于borrowed成员,deserializer可以借用输入里的对应部分。serde_json序列化时会将所有部分转换成字符串,这样除非这个成员是字符串, 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(3) 评论(0) 推荐(0) 编辑
摘要: title: rust scoped thread date: 2021-05-19 19:00:03 rust里,std::thread::spawn要求传入的闭包的生命周期必须是'static的,也就是说闭包中不能借用局部变量,因为rust不知道这个局部变量会不会突然就被释放了。但是一般情况下, 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 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 寻找繁星 阅读(0) 评论(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 寻找繁星 阅读(1) 评论(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 寻找繁星 阅读(0) 评论(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 寻找繁星 阅读(0) 评论(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 寻找繁星 阅读(3) 评论(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 寻找繁星 阅读(0) 评论(0) 推荐(0) 编辑
摘要: title: rust单行读取多个整数 date: 2020-08-15 10:49:13 tags: rust读取真的很麻烦。网上的方法一般是用split(' ')来分割出整数。但是如果中间有多个空格就凉了。后面查阅官方文档发现了split_whitespace,可以用多个空白字符(空格和tab, 阅读全文
posted @ 2024-09-28 14:16 寻找繁星 阅读(3) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 66 下一页