Protocol std::hash::Hashable

protocol Hashable<Self, H> { ... }
H: Hasher<H>

Types that can be hashed.

The hash method can be implemented directly or a default implementation can be mixed in, in which case the memory representation of the type is used as an input to the hash function.

This is only recommended if the memory layout of the type does not contain padding, as the value of the padding bytes may be unpredictable and cause undefined behavior.

Examples

A default implementation

A custom implementation

Provided methods