Skip to main content

Module collation

Module collation 

Source
Expand description

Collation callback trait, built-in collations, and registry (§9.4, §13.6).

Collations are pure comparators used by ORDER BY, GROUP BY, DISTINCT, and index traversal. They are open extension points.

compare is intentionally CPU-only and does not accept &Cx.

The CollationRegistry maps case-insensitive names to collation implementations and is pre-populated with the three built-in collations.

§Contract

Implementations must be:

  • Deterministic: same inputs always produce the same output.
  • Antisymmetric: compare(a, b) is the reverse of compare(b, a).
  • Transitive: if a < b and b < c, then a < c.

Structs§

BinaryCollation
BINARY collation: raw memcmp byte comparison.
CollationAnnotation
An operand’s collation annotation: the collation name and where it came from.
CollationRegistry
Registry for collation functions, keyed by case-insensitive name.
NoCaseCollation
NOCASE collation: ASCII case-insensitive comparison.
RtrimCollation
RTRIM collation: trailing-space-insensitive comparison.

Enums§

CollationSource
Source of a collation for precedence resolution (§13.6).

Traits§

CollationFunction
A collation comparator.

Functions§

resolve_collation
Resolve which collation to use for a binary comparison (§13.6).