mem_tools

Crates.iomem_tools
lib.rsmem_tools
version0.6.0
sourcesrc
created_at2022-06-26 15:05:12.593397
updated_at2024-05-11 22:35:40.92656
descriptionCollection of tools to manipulate memory.
homepagehttps://github.com/Wandalen/wTools/tree/master/module/core/mem_tools
repositoryhttps://github.com/Wandalen/wTools/tree/master/module/core/mem_tools
max_upload_size
id613576
size33,931
Wandalen (Wandalen)

documentation

https://docs.rs/mem_tools

README

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)

Commit count: 0

cargo fmt