摘要:
title: rust进度条 date: 2021-07-07 16:45:40 用indicatif即可。 官方文档:https://docs.rs/indicatif/0.16.2/indicatif/ 一个简单的例子: use indicatif::ProgressBar; fn main() 阅读全文
posted @ 2024-09-28 14:16
寻找繁星
阅读(83)
评论(0)
推荐(0)
摘要:
title: rust泛型初始化成0 date: 2020-09-04 00:02:25 tags: std::num::Int被deprecated了。所以只能用别人的crate或者自己实现Zero了。 github上有一个不错的: https://github.com/rust-num/num- 阅读全文
posted @ 2024-09-28 14:16
寻找繁星
阅读(33)
评论(0)
推荐(0)
摘要:
title: rust存取一个含有borrowed域的结构体 date: 2021-07-28 10:31:32 直接存取不可以: use std::io; use serde::{Serialize, Deserialize}; extern crate bincode; #[derive(Deb 阅读全文
posted @ 2024-09-28 14:16
寻找繁星
阅读(25)
评论(0)
推荐(0)
摘要:
title: rust 定时执行 date: 2021-08-16 16:20:40 tokio = { "version" = "1.10", features = ["full"] } use tokio::time; async fn print() { let mut interval = 阅读全文
posted @ 2024-09-28 14:16
寻找繁星
阅读(95)
评论(0)
推荐(0)
摘要:
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
寻找繁星
阅读(62)
评论(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
寻找繁星
阅读(44)
评论(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
寻找繁星
阅读(105)
评论(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
寻找繁星
阅读(23)
评论(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
寻找繁星
阅读(28)
评论(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
寻找繁星
阅读(32)
评论(0)
推荐(0)

浙公网安备 33010602011771号