Skip to content

Hashable

All hashable types must nominally inherit from this type.

graph BT
N1["Hashable"] -->|inherits| N2["Any"];

Characteristics

Quality Value
Inherits global.Any
Extends N/A
Decorators N/A
Is enum false
Is sealed false
Is extern false
Is abstract true
Is generator false
Has value semantics false
Has stored properties false
Should register destructor false
Has atomic memory true
Is copy assignable false
Is zero initializable true

Functions

from_variable

from_variable [T] (var @T?, hasher strictly @ (Pointer, Len) -> Nil) -> Nil
helper function to apply the hasher to a variable of type T so you won't have to deal with pointers


Methods

construct

#default
#Gambol.function.alwaysinline
construct (s strictly @Self) -> Self

hash

#strict
hash (s @Self, hasher strictly @ (Pointer, Len) -> Nil) -> Nil
abstract all hashable types must override this method. It has a strict interface and takes one parameter hasher which is a function taking a pointer to a block of memory to be hashed along with the length of that block. If you are overriding hash for your type you can apply the hasher function on every block of memory that is relavant to hashing in your hash method.