pub enum ReadMode {
}Expand description
The mode a ctx_read call resolves to.
Density carries an f64, so the enum is PartialEq but not Eq.
Variants§
Full
Verbatim, edit-ready (framed) — "full".
FullCompact
Headerless, trailing-whitespace-stripped verbatim — "full-compact".
Used by the Read redirect to produce temp files faithful to the
original line structure while saving framing overhead.
Anchored(Option<LineRange>)
Verbatim + per-line N:hh| hash anchors, edit-ready for ctx_patch
(epic #1008) — "anchored", or windowed as "anchored:N-M" (#811) so a
bounded anchored read never has to materialize/anchor the whole file.
Raw
Exact bytes, no framing — "raw".
Signatures
API surface — "signatures".
Map
Structural outline — "map".
Aggressive
Aggressive lossy summary — "aggressive".
Entropy
Entropy-pruned summary — "entropy".
Cognitive
Semantic chunking (7±2 chunks via Miller’s Law) — "cognitive".
Mdl
MDL structural description — "mdl".
Task
Task-focused summary — "task".
Reference
One-line pointer/quote — "reference".
Auto
Learned/auto mode selection — "auto".
Diff
Git delta vs the cached copy — "diff".
Lines(LineRange)
Line window — "lines:start-end".
LinesMulti(String)
Comma multi-select — "lines:5,10-20" (#971).
The parts are validated but kept verbatim rather than re-derived into
Vec<LineRange>. The window semantics live in
render::extract_line_range, which reads the raw mode string, so a
structured payload here would have no consumer — and it could not
round-trip: a bare 5 selects line 5, which no LineRange spells
without becoming 5-5. Validation is what this type owes its callers;
interpretation belongs to the renderer.
LinesTail(u32)
Tail window — "lines:-N", the last N lines of the file (#1759).
This is what the Bash-hook rewrite turns tail -N file into. It used
to be rejected as malformed, so every rewritten tail failed with a
parse error instead of returning the last N lines. Like LinesMulti
the window is resolved by render::extract_line_range — it needs the
file’s line count — so only the count is carried here.
Density(f64)
Target-density compression — "density:0.NN".
Implementations§
Source§impl ReadMode
impl ReadMode
Sourcepub fn is_compressed_cacheable(&self) -> bool
pub fn is_compressed_cacheable(&self) -> bool
map/signatures — the lossy summaries whose rendered body is stored in
the per-file compressed_outputs cache. Replaces is_cacheable_mode.
Sourcepub fn allows_raw_cap(&self) -> bool
pub fn allows_raw_cap(&self) -> bool
Whole-file views the #361 anti-inflation raw cap applies to. Selection
and delta views (lines:, reference, diff, raw) have view-specific
semantics and are never capped. Replaces mode_allows_raw_cap.
Sourcepub fn is_lossy_summary(&self) -> bool
pub fn is_lossy_summary(&self) -> bool
Lossy summaries eligible for cross-file block dedup (#…): the body is a
summary, so shared blocks can be elided. Replaces the inline
dedup_allowed match.
Sourcepub fn counts_as_compressed(&self) -> bool
pub fn counts_as_compressed(&self) -> bool
Whether a read in this mode counts as “compressed” for bounce/quality
tracking (#538). Only verbatim full and the diff delta are not
compressed. Replaces the inline !matches!(mode, "full"|"diff"|"lines")
predicate — a resolved line window is the string "lines:N-M", never the
bare "lines", so that arm was dead and Lines stays compressed here.
Sourcepub fn is_precise_pinned_read(&self) -> bool
pub fn is_precise_pinned_read(&self) -> bool
Precise, pinned reads (#843): the caller asked for an exact byte-window
or delta and must get exactly that back. Context-gate overrides
(bounce-prevention, pressure-downgrade, graph/knowledge heuristics)
must never silently reinterpret one of these to e.g. full — that
discards the window/anchors/delta the caller explicitly asked for.
Kept as an enum match (not a string-prefix check) so a future mode
variant that’s also precise/pinned has to be added here explicitly
instead of silently falling through an allowlist.
Trait Implementations§
impl StructuralPartialEq for ReadMode
Auto Trait Implementations§
impl Forget for ReadMode
impl Freeze for ReadMode
impl Move for ReadMode
impl RefUnwindSafe for ReadMode
impl Send for ReadMode
impl Sync for ReadMode
impl Unpin for ReadMode
impl UnsafeUnpin for ReadMode
impl UnwindSafe for ReadMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more