# Module :: `mem_tools`
<!--{ generate.module_header.start() }-->
[](https://github.com/emersion/stability-badges#experimental) [](https://github.com/Wandalen/wTools/actions/workflows/workspace_push.yml) [](https://docs.rs/mem_tools) [](https://gitpod.io/#RUN_PATH=.,SAMPLE_FILE=module%2Fexperimental%2Fmem_tools%2Fexamples%2Fmem_tools_trivial.rs,RUN_POSTFIX=--example%20mem_tools_trivial/https://github.com/Wandalen/wTools) [](https://discord.gg/m3YfbXpUUY)
<!--{ generate.module_header.end }-->
Collection of tools to manipulate memory.
Performant size / pointer / region / data comparing.
### Basic use-case
<!-- {{# generate.module{} #}} -->
```rust
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
```sh
cargo add mem_tools
```
### Try out from the repository
```sh
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/mem_tools_trivial
cargo run
```
# Sample
[](https://discord.gg/m3YfbXpUUY)
[](https://gitpod.io/#RUN_PATH=sample%2Frust%2Fmem_tools_trivial,SAMPLE_FILE=.%2Fsrc%2Fmain.rs/https://github.com/Wandalen/wTools)
[](https://docs.rs/mem_tools)