Crates.io | mem_tools |
lib.rs | mem_tools |
version | 0.8.0 |
source | src |
created_at | 2022-06-26 15:05:12.593397 |
updated_at | 2024-10-30 21:35:49.971923 |
description | Collection of tools to manipulate memory. |
homepage | https://github.com/Wandalen/wTools/tree/master/module/core/mem_tools |
repository | https://github.com/Wandalen/wTools/tree/master/module/core/mem_tools |
max_upload_size | |
id | 613576 |
size | 15,028 |
Collection of tools to manipulate memory.
Performant size / pointer / region / data comparing.
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