| Crates.io | address-cmp |
| lib.rs | address-cmp |
| version | 0.2.1 |
| created_at | 2021-07-07 14:17:51.914626+00 |
| updated_at | 2021-07-10 13:22:51.61603+00 |
| description | An attribute for address comparison |
| homepage | |
| repository | https://github.com/Xavientois/address-cmp |
| max_upload_size | |
| id | 419899 |
| size | 14,668 |
A set of macros to allow your types to be compared based on where they are stored in memory. This is useful when two instances of a type should not be considered equal unless they are literally the same instance.
With this crate, you can derive AddressEq, AddressOrd, or AddressHash depending on your needs.
use address_cmp::AddressEq;
#[derive(AddressEq, Debug)]
struct A {
pub a: u8,
}
let a1 = A { a: 0 };
let a2 = A { a: 0 };
assert_ne!(a1, a2);
assert_eq!(a1, a1);