软件中一个非常重要的部分是单元测试,毕竟,它们帮助我们验证那些我们脑海中的案例是否确实被正确实现,同时也确保了将来可能会修改我们代码的下一个幸运者能够自信他们的改动不会破坏应用程序
本文介绍了如何编写基本的单元测试.
原文链接 https://dev.to/thiagomg/a-simple-guide-to-unit-tests-in-rust-4h8l
“GraphPU” 是一款 3D GPU 图形可视化应用程序。基于 Rust 语言和 WebGPU 开发的渲染框架和高性能计算 (HPC) 算法,使得这个应用能够在 Vulkan 和 Metal 平台上实时模拟和渲染数百万个节点和边。演示包括了多个大规模图形数据集,包括电影语义学、电子邮件、大型网站结构、个人微信关系以及社交媒体连接。观众可以通过控制器旋钮与这些数据进行互动
原文链接 https://troyni.com/graphpu 以及 github 地址 https://github.com/latentcat/graphpu
sh 是一个用于运行外部命令的宏。它提供了将输入和输出管道到变量的功能,以及使用 Rust 表达式作为程序参数的功能。
代码示例
let world = "world";
let mut out = String::new();
sh!(echo hello {world} > {&mut out});
assert_eq!(out, "hello world\n");
// We can also pipe a String/&str or Vec<u8>/&[u8] to a command
out.clear();
let input = "foo bar baz";
sh!(cat < {input} > {&mut out});
assert_eq!(&out, input);
// We can execute many commands at once
let mut out1 = String::new();
let mut out2 = String::new();
let mut out3 = String::new();
sh! {
echo hello world 1 > {&mut out1}; // Note the `;`
echo hello world 2 > {&mut out2};
echo hello world 3 > {&mut out3};
}
assert_eq!(&out1, "hello world 1\n");
assert_eq!(&out2, "hello world 2\n");
assert_eq!(&out3, "hello world 3\n");
sh
crate https://docs.rs/sh/0.2.1/sh/