Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memdebug
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.doc
core.encoding
core.encoding.base64
core.encoding.csv
core.encoding.hex
core.encoding.json
core.encoding.kdl
core.encoding.osad
core.encoding.utf8
core.hash
core.hash.md5
core.hash.sha1
core.hash.sha256
core.heap
core.intrinsics
core.intrinsics.atomics
core.intrinsics.onyx
core.intrinsics.types
core.intrinsics.wasm
core.io
core.io.binary
core.iter
core.js
core.list
core.map
core.math
core.memory
core.misc
core.net
core.os
core.random
core.set
core.slice
core.string
core.sync
core.test
core.thread
core.time
main
runtime
runtime.info
runtime.platform
runtime.vars
simd

package core.hash

hash
hash :: (key: rawptr) -> u32
hash :: (p: Pair($First_Type, $Second_Type)) -> #auto
    where hash.Hashable(First_Type), hash.Hashable(Second_Type)
hash :: (key: i8) -> u32
hash :: (key: i16) -> u32
hash :: (key: i32) -> u32
hash :: (key: i64) -> u32
hash :: (key: [] u8) -> u32
hash :: (key: type_expr) -> u32
hash :: (key: bool) -> u32
hash :: (key: $T) -> u32
    where type_is_enum(T)
hash :: macro (key: $T) -> #auto
    where HasHashMethod(T)

This overloaded procedure defines how to hash something. It is used throughout the standard library to hash values. There are many overloads to it in the standard library, and more can be added using #overload.

Alternatively, a hash method can be defined for a structure or distinct type.

Person :: struct {
    hash :: (p: Person) -> u32 {
        return // ...
    }
}