#general-purpose #memory

no-std dev mem_tools

Collection of tools to manipulate memory

9 breaking releases

new 0.10.0 Jun 9, 2026
0.9.0 Jun 21, 2025
0.8.0 Oct 30, 2024
0.6.0 May 11, 2024
0.1.1 Jul 15, 2022

#2933 in Algorithms

Download history 418/week @ 2026-02-20 385/week @ 2026-02-27 155/week @ 2026-03-06 341/week @ 2026-03-13 305/week @ 2026-03-20 186/week @ 2026-03-27 168/week @ 2026-04-03 280/week @ 2026-04-10 249/week @ 2026-04-17 207/week @ 2026-04-24 208/week @ 2026-05-01 289/week @ 2026-05-08 869/week @ 2026-05-15 486/week @ 2026-05-22 602/week @ 2026-05-29 323/week @ 2026-06-05

2,334 downloads per month
Used in 35 crates (2 directly)

MIT license

20KB
113 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 the same, not taking into account 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

No runtime deps