#general-purpose #fundamental #repository

no-std dev mem_tools

Collection of tools to manipulate memory

9 releases (breaking)

0.8.0 Oct 30, 2024
0.6.0 May 11, 2024
0.5.0 Mar 16, 2024
0.1.1 Jul 15, 2022

#2681 in Algorithms

Download history 857/week @ 2024-12-02 343/week @ 2024-12-09 372/week @ 2024-12-16 82/week @ 2024-12-23 143/week @ 2024-12-30 98/week @ 2025-01-06 69/week @ 2025-01-13 193/week @ 2025-01-20 60/week @ 2025-01-27 96/week @ 2025-02-03 108/week @ 2025-02-10 254/week @ 2025-02-17 233/week @ 2025-02-24 364/week @ 2025-03-03 316/week @ 2025-03-10 235/week @ 2025-03-17

1,150 downloads per month
Used in 75 crates (4 directly)

MIT license

11KB
123 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

Features