Skip to main content

ReadMode

Enum ReadMode 

Source
pub enum ReadMode {
Show 18 variants Full, FullCompact, Anchored(Option<LineRange>), Raw, Signatures, Map, Aggressive, Entropy, Cognitive, Mdl, Task, Reference, Auto, Diff, Lines(LineRange), LinesMulti(String), LinesTail(u32), Density(f64),
}
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for ReadMode

Source§

fn clone(&self) -> ReadMode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReadMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for ReadMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl FromStr for ReadMode

Source§

type Err = ParseModeError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<ReadMode, <ReadMode as FromStr>::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for ReadMode

Source§

fn eq(&self, other: &ReadMode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ReadMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more