Expand description
Collection of tools to manipulate memory.
§Module :: mem_tools
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
Modules§
- dependency
- Namespace with dependencies.
- exposed
- Exposed namespace of the module.
- mem
- Collection of general purpose meta tools.
- orphan
- Orphan namespace of the module.
- own
- Own namespace of the module.
- prelude
- Prelude to use essentials:
use my_module::prelude::*
.
Functions§
- same_
data - Are two pointers points on the same data.
- same_
ptr - Are two pointers are the same, not taking into accoint type.
- same_
region - Are two pointers points on the same region, ie same size and same pointer.
- same_
size - Are two pointers points on data of the same size.