#hash #derive #pointers #reference

macro compare_by_address_derive

Derive macro for comparing and hashing structs/unions/enums by address

2 releases

0.1.1 Mar 26, 2022
0.1.0 Mar 20, 2022

#226 in #pointers

MIT/Apache

4KB

Defines PartialEq, Eq, and Hash to compare the given struct/union/enum by address to other instances. This allows you to easily work with these items in hashing contexts (HashSets, HashMaps, etc.) whereby equality is defined by instance irrespective of content.

Example usage

use compare_by_address_derive::CompareByAddress;

#[derive(CompareByAddress)]
struct SomeStruct {
  // ...
}

Dependencies

~1.5MB
~37K SLoC