ExBoxPacker.Sorting.ItemSorter behaviour (ExBoxPacker v0.2.0)

Copy Markdown View Source

Behaviour for ordering items before packing (analog of BoxPacker's ItemSorter).

Summary

Callbacks

Return a negative int if a sorts before b, positive if after, 0 if equal.

Functions

Compare two terms and return -1, 0, or 1 (PHP spaceship semantics).

Callbacks

compare(a, b)

@callback compare(a :: ExBoxPacker.Item.t(), b :: ExBoxPacker.Item.t()) :: integer()

Return a negative int if a sorts before b, positive if after, 0 if equal.

Functions

cmp(a, b)

@spec cmp(term(), term()) :: -1 | 0 | 1

Compare two terms and return -1, 0, or 1 (PHP spaceship semantics).