Function ::std::ops::hash

Overview
fn hash(value) -> i64

Hashes the given value.

For non-builtin types this uses the [HASH] protocol.

Hash stability

The hash is guaranteed to be stable within a single virtual machine invocation, but not across virtual machines. So returning the hash from one and calculating it in another using an identical value is not guaranteed to produce the same hash.

Panics

Panics if we try to generate a hash from an unhashable value.

Examples

use std::ops::hash;

assert_eq!(hash([1, 2]), hash((1, 2)));