Std.Hash

import Std.Hash

Source


Traits


Hash

trait Hash t =
    hash: fn t -> U64

source


Functions


hash_combine

hash_combine (h1: U64) (h2: U64): U64

Combine two hashes to form a new one. This is order-sensitive so (a, b) and (b, a) hash differently. Uses a mixing constant of 2^64 / phi.

source


Implicits


Show Implicits

hash_string

impl hash_string: Hash String

FNV-1a 64-bit with an offset basis of 14695981039346656037 (0xcbf29ce484222325), and prime of 1099511628211 (0x100000001b3).

source


hash_u64

impl hash_u64: Hash U64

source


hash_u8

impl hash_u8: Hash U8

source


hash_u16

impl hash_u16: Hash U16

source


hash_u32

impl hash_u32: Hash U32

source


hash_usz

impl hash_usz: Hash Usz

source


hash_i8

impl hash_i8: Hash I8

source


hash_i16

impl hash_i16: Hash I16

source


hash_i32

impl hash_i32: Hash I32

source


hash_i64

impl hash_i64: Hash I64

source


hash_isz

impl hash_isz: Hash Isz

source


hash_f32

impl hash_f32: Hash F32

source


hash_f64

impl hash_f64: Hash F64

source


hash_bool

impl hash_bool: Hash Bool

source


hash_char

impl hash_char: Hash Char

source


hash_pair

impl hash_pair {_: Hash a} {_: Hash b}: Hash (a, b)

source


hash_maybe

impl hash_maybe {_: Hash a}: Hash (Maybe a)

source


hash_result

impl hash_result {_: Hash a} {_: Hash e}: Hash (Result a e)

source