Helix是一个Rust写的编辑器,本次更新如下。
GitHub: https://github.com/helix-editor/helix
profi是一个支持单线程/多线程细粒度的性能分析器。
使用示例:
// 基本方法
use profi::{prof, print_on_exit};
fn main() {
// Prints the timings to stdout when the program exits
// Always put at the top of the main function to ensure it's dropped last
//
// An implicit `main` guard is created to profile the whole application
print_on_exit!();
// Sleep for a bit to simulate some work
std::thread::sleep(std::time::Duration::from_millis(200));
}
// 循环
use profi::{prof, print_on_exit};
fn main() {
print_on_exit!();
for _ in 0..100 {
prof!(iteration);
std::thread::sleep(std::time::Duration::from_millis(10));
}
}
// 多线程
use profi::{print_on_exit, prof_guard};
fn do_work(i: usize) {
// Need to bind it to a variable to ensure it isn't dropped before sleeping
let _guard = if i < 6 {
prof_guard!("6 first")
} else {
prof_guard!("4 last")
};
std::thread::sleep(std::time::Duration::from_millis(10));
// The guard goes out of scope here
}
fn main() {
print_on_exit!();
// Spawn 10 threads
std::thread::scope(|s| {
for i in 0..10 {
s.spawn(move || {
do_work(i);
});
}
});
}
GitHub: https://github.com/lyonsyonii/profi
terrors是一个Rust处理错误的库,设计原则包括:
简单使用示例:
use terrors::OneOf;
let one_of_3: OneOf<(String, u32, Vec<u8>)> = OneOf::new(5);
let narrowed_res: Result<u32, OneOf<(String, Vec<u8>)>> =
one_of_3.narrow();
assert_eq!(5, narrowed_res.unwrap());
GitHub: https://github.com/komora-io/terrors
有网友推荐一个YouTube的学习视频,一共37个视频,感兴趣的读者不妨查阅。
链接: https://www.youtube.com/watch?v=lTjGt17bQ3k&list=PLDbRgZ0OOEpUkWDGqp91ODn0dk7LPBAUL&index=1