Expand description
Type-safe ctx_read modes (#528 / #509 Phase 2).
Historically the read mode travelled through the whole pipeline as a bare
&str ("full", "map", "lines:5-10", "density:0.40", …) and the
knowledge of which modes exist — and how each one is classified (cacheable?
lossy summary? counts as compressed?) — was duplicated across the registered
handler, the read core and render.rs. That stringly-typed design let invalid
states slip through (silently falling back to full) and let the duplicated
classifications drift.
ReadMode is the single source of truth for the mode vocabulary:
ReadMode::from_strparses (and validates) the canonical strings.Displayround-trips byte-identically to those same strings, so the type can be threaded through the typed decision points without touching the string-mode MCP boundary orrender.rs(back-compat).- the classification methods (
ReadMode::is_compressed_cacheable,ReadMode::allows_raw_cap,ReadMode::is_lossy_summary,ReadMode::counts_as_compressed) replace the scatteredmatches!(mode, …)predicates, and the test module locks each one to the legacy predicate it replaces so behaviour can never silently change.
Structs§
- Line
Range - A 1-based, inclusive line window (
lines:start-end).
Enums§
- Parse
Mode Error - Error returned when a string is not a recognised
ReadMode. - Read
Mode - The mode a
ctx_readcall resolves to.
Functions§
- canonicalize_
tail_ mode - Rewrite the documented bare tail spelling
-Nto its canonicallines:-Nform (#1813).