7 个版本 (破坏性更新)
0.6.0 | 2024 年 5 月 11 日 |
---|---|
0.5.0 | 2024 年 3 月 16 日 |
0.4.0 | 2024 年 3 月 16 日 |
0.3.0 | 2024 年 3 月 16 日 |
0.1.0 | 2022 年 6 月 26 日 |
#1115 在 开发工具
1,656 每月下载量
用于 91 个 Crates (4 个直接使用)
10KB
111 代码行
模块 :: mem_tools
内存操作工具集合。
高效的尺寸/指针/区域/数据比较。
基本用例
use mem_tools as mem;
// Are two pointers are the same, not taking into accoint type.
// Unlike `std::ptr::eq()` does not require arguments to have the same type.
let src1 = ( 1, );
let src2 = ( 1, );
assert!( !mem::same_ptr( &src1, &src2 ) );
// Are two pointers points on data of the same size.
let src1 = "abc";
let src2 = "cba";
assert!( mem::same_size( src1, src2 ) );
// Are two pointers points on the same region, ie same size and same pointer.
// Does not require arguments to have the same type.
let src1 = "abc";
let src2 = "abc";
assert!( mem::same_region( src1, src2 ) );
添加到您的项目
cargo add mem_tools
从仓库中尝试
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/mem_tools_trivial
cargo run