Skip to main content

Module cost

Module cost 

Source
Expand description

Fixed-point edit costs (unit = 16) and keyboard-layout adjacency.

Integer costs make the search bounds exact and the results identical on every platform. All values below are provisional until the calibration phase.

Structs§

CostModel
Costs of the four edit operations.

Enums§

Layout
A physical keyboard layout, from which the neighbouring-key relation of a CostModel is derived.

Constants§

COST_UNIT
The cost of one ordinary edit. Every cost in the table below is expressed in these units: cheaper edits (a neighbouring key, a doubled letter, a transposition) cost a fraction of it, edits on the first byte cost more.
INF
Sentinel for “unreachable or over budget”. INF plus any single edit cost still fits in a u16.

Functions§

class
The class of the byte b read as the code point U+0000 to U+00FF: the same as symbol_class(b.into()). For ASCII that is bit b & 63.
symbol_class
Bit that represents the character class of symbol s (used by subtree signatures). Symbols are Unicode scalar values (see docs/design/unicode.md).
whole_units
The weighted cost rounded up to whole units of COST_UNIT: 0 stays 0, 1 to 16 is one unit, 17 to 32 two units, and so on.

Type Aliases§

Cost
A fixed-point edit cost (16 = one ordinary edit).