equivalence
This crate provides traits for comparing and hashing values modulo an equivalence relation specified by a context of user-defined type C.
The Equivalence derive macro allows the user to easily implement Equivalence for custom types.
Example
# use *;
# use Ordering;
# use ;
/// The equivalence relation mod n over 64-bit unsigned integers
;
// Containers can be conveniently compared and hashed modulo a given equivalence context:
assert!;
assert!;
// The `Equivalence` derive macro can be used to derive `Equivalence` for custom containers
assert!;
assert!;
// We may also use the macro to derive `Equivalence` for a particular context only, with custom logic
assert!;
assert!;
Planned Features
The crate is currently quite minimal, but we plan to add:
- Support for
no_std - Better documentation
- Extra forwarding options, such as forwarding to
Deref - Support for comparing collections other than arrays (which are already supported)