6 releases (breaking)

0.5.0 Mar 16, 2024
0.4.0 Mar 16, 2024
0.3.0 Mar 16, 2024
0.2.0 Mar 1, 2024
0.1.0 Jun 26, 2022

#630 in Development tools

Download history 227/week @ 2023-12-22 138/week @ 2023-12-29 227/week @ 2024-01-05 293/week @ 2024-01-12 207/week @ 2024-01-19 200/week @ 2024-01-26 209/week @ 2024-02-02 262/week @ 2024-02-09 444/week @ 2024-02-16 421/week @ 2024-02-23 557/week @ 2024-03-01 1691/week @ 2024-03-08 4097/week @ 2024-03-15 1166/week @ 2024-03-22 763/week @ 2024-03-29 538/week @ 2024-04-05

7,055 downloads per month
Used in 80 crates (4 directly)

MIT license

10KB
111 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

No runtime deps