baml.Hash

Feeds a value into a `baml.hash.Hasher`.

Reference version

Signature

interface baml.Hash

Feeds a value into a baml.hash.Hasher.

Equal values must feed equivalent hash input into the same initial hasher state. A custom implementation must agree with baml.ops.Equals; neither the compiler nor the runtime can verify arbitrary implementations.

Data types with structural equality have an implicit implementation when their fields or elements support Hash. A custom Equals.eq requires a compatible explicit Hash implementation, including when the matching equality declaration has generic bounds. Cyclic structural values panic; repeated references to an acyclic value are hashed by value.

Keep the hash and equality of a stored map key stable. Hash values and their input encoding are not portable identifiers or a serialization format.

Source:<builtin>/baml/hashing.bamlbytes 811–900

Required instance methods