8 breaking releases

0.9.0 Jun 21, 2025
0.8.0 Oct 30, 2024
0.7.0 Sep 14, 2024
0.6.0 May 11, 2024
0.1.1 Jul 15, 2022

#1568 in Algorithms

Download history 70/week @ 2025-03-22 179/week @ 2025-03-29 456/week @ 2025-04-05 71/week @ 2025-04-12 544/week @ 2025-04-19 262/week @ 2025-04-26 167/week @ 2025-05-03 137/week @ 2025-05-10 249/week @ 2025-05-17 85/week @ 2025-05-24 52/week @ 2025-05-31 165/week @ 2025-06-07 214/week @ 2025-06-14 904/week @ 2025-06-21 391/week @ 2025-06-28 670/week @ 2025-07-05

2,209 downloads per month
Used in 73 crates (4 directly)

MIT license

12KB
118 lines

Module :: mem_tools

experimental rust-status docs.rs Open in Gitpod discord

Collection of tools to manipulate memory.

Performant size / pointer / region / data comparing.

Basic use-case


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 ) );

To add to your project

cargo add mem_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/mem_tools_trivial
cargo run

Sample

discord Open in Gitpod docs.rs docs.rs](https://docs.rs/meta_tools)

No runtime deps