TermBuf::StyleTable
Stability: internal
Interns styles so a Cell can carry a four byte id rather than the whole
struct.
Two cells with equal styles always get the same id, which turns the paint diff's style comparison into an integer compare and lets the encoder cache one SGR byte string per id.
The table only grows. An application cycling through distinct styles — an animated colour gradient, say — accumulates entries at roughly 32 bytes each; a hundred thousand of them costs a few megabytes. Real applications use tens.
Constants
DEFAULT = 0_u32
The id of Style::DEFAULT, which every table assigns first.
Constructors
new
SourceInstance methods
id(style : Style) : StyleId
The id for style, assigning one if this is the first time it is seen.