Expand description
RenderGrid + FilterChain framework (E012 US1/US5 — Phase 4/5).
Public types: filter::RenderGrid, filter::Cell,
filter::Color, filter::Filter, filter::FilterChain.
Individual filter implementations are gated behind their respective
filter-<name> leaves (see Cargo.toml). The filter::Filter::Nothing
identity has no leaf — always available — so an empty chain or an
all-Nothing chain compiles on any feature surface.
RenderGrid + FilterChain (E012 US1/US5 — FR-002, FR-003, FR-004).
This module hosts the typed grid that filters operate on, the
[Filter] enum enumerating the 10 supported transformations, the
[FilterChain] orchestrator, and the per-filter pure-function
implementations. Each individual filter is gated behind its leaf
feature (filter-crop, filter-gay, filter-metal, filter-flip,
filter-flop, filter-rotate, filter-border) per ADR-0006 +
plan §Cargo Feature Surface; the [Filter::Nothing] identity has no
leaf and is always available.
§Design constraints
- Immutability (AD-002) — every filter takes an owned [
RenderGrid] and returns a new owned grid. No interior mutability, no shared borrows, no in-place transforms. - Bounded cell footprint (AD-011) — [
Cell] is ~16 bytes; the grid memory isO(w·h)and a chain ofnfilters costsO(n·w·h)(HINT-006 + FR-030). - No upstream-source consultation — implementations derived from
the toilet(1) manpage and observed outputs; recorded under
docs/tlf-derivation.md.
Structs§
- Cell
- A single rendered cell: a character plus optional color attributes.
- Filter
Chain - Ordered list of
Filters applied left-to-right inFilterChain::apply(FR-004). - Render
Grid - A 2D grid of
Cells with explicitwidth×heightdimensions.
Enums§
- Color
- Color carried by a
Cell— bounded footprint per AD-011. - Filter
- The 10 supported toilet-compatible filters (FR-003).
- Named
Color - One of the 16 ANSI named colors.