Skip to main content

MatrixVersion

Struct MatrixVersion 

Source
pub struct MatrixVersion {
    pub text: u64,
    pub syntax: u64,
    pub inlay_hints: u64,
    pub folds: u64,
    pub theme: u64,
    pub whitespace: u64,
    pub indent: u64,
    pub conceal: u64,
}
Expand description

Per-source version stamps that drive matrix rebuild decisions.

Decoration kinds that don’t change cell content (cursor, selection, hlsearch, diagnostics, doc highlights, search matches) deliberately don’t appear here — they live in OverlayState (defined in lattice-host in S2) and are read by the paint loop each frame without triggering matrix work.

Fields are u64 to match the source counters/hashes in lattice-host (document.text_version(), compute_fold_hash, inlay_hints_version, etc.) — no lossy cast at the boundary.

Fields§

§text: u64

Source of truth: document.text_version(). Monotonic.

§syntax: u64

Source of truth: content stamp of the syntax span set covering the buffer. Hash-style (not monotonic).

§inlay_hints: u64

Source of truth: inlay_hints_version(&inlays). Hash-style.

§folds: u64

Source of truth: compute_fold_hash(&folds). Hash-style.

§theme: u64

Source of truth: theme palette revision. Monotonic in practice (theme replacements are discrete events).

§whitespace: u64

2026-05-27: display.whitespace.* snapshot hash. Bumps when display.show_whitespace toggles or any of the display.whitespace.* glyphs change. The cell-builder substitutes whitespace bytes with marker glyphs + the WS_MARKER flag at emission time, so the glyph ends up in Cell.ch — folding the config into this axis invalidates the cached matrix when the user re-configures.

§indent: u64

IG.2 (2026-08-16): shiftwidth + the display.indent-guides.* snapshot hash. Indentation guides are built beside the display matrix from the same snapshot, so they need an axis that makes the worker rebuild when their inputs change.

Deliberately NOT folded into Self::whitespace, even though both are display-config axes: renderers gate painting on the whitespace axis (a mismatch drops the viewport to raw text for a frame), and toggling guides must not cost a whole-viewport fallback when the display text is not affected at all. This axis gates the rebuild only — like syntax, folds and theme.

§conceal: u64

H.3 (2026-08-29): the conceal inputs — the buffer language’s rule set plus whether the modal state reveals (H.4). Bumps when either moves. See docs/dev/architecture/conceal.md.

Painting-class, like whitespace and unlike indent. The distinction is on indent above: conceal changes the display text, so a renderer painting a matrix stamped with a stale conceal axis would show the wrong characters, not merely a missing decoration. A mismatch therefore drops the viewport to raw text for one frame — which is the correct degradation, and is the same frame the mode transition was going to repaint.

Constant for every buffer whose language declares no rules. That is what keeps i in a Rust file from costing a viewport rebuild: the axis cannot move if there is nothing to conceal.

Implementations§

Source§

impl MatrixVersion

Source

pub const ZERO: Self

All-zero version stamp. Equivalent to Default::default().

Source

pub fn differs_from(&self, other: &Self) -> bool

true when any component differs from other. Used by the cell-builder worker to decide if a cached chunk’s version is stale relative to the current RenderState version. Works uniformly across monotonic and hash-style axes.

Source

pub fn differing_axes(&self, other: &Self) -> Vec<&'static str>

The names of the axes that differ, for logging.

A stale-render report is always the same question — the matrix did not rebuild, so WHICH invalidation axis failed to move? Answering it from two opaque version structs means eyeballing seven u64s in a log line; answering it from ["syntax"] is immediate. Allocates, so it is only ever called from a debug! argument that a disabled level never evaluates.

Trait Implementations§

Source§

impl Clone for MatrixVersion

Source§

fn clone(&self) -> MatrixVersion

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 Copy for MatrixVersion

Source§

impl Debug for MatrixVersion

Source§

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

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

impl Default for MatrixVersion

Source§

fn default() -> MatrixVersion

Returns the “default value” for a type. Read more
Source§

impl Eq for MatrixVersion

Source§

impl Hash for MatrixVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MatrixVersion

Source§

fn eq(&self, other: &MatrixVersion) -> 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 MatrixVersion

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

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

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