pub struct Registry<'src> {
table: EytzingerMap<u32, NodeRef<'src>>,
}Expand description
Whole-document registry — single Eytzinger-keyed table.
node_at is one binary search, and every entry’s sentinel kind is
encoded by the NodeRef variant — renderers pattern-match the
hit inline rather than dispatching across per-kind tables.
Fields§
§table: EytzingerMap<u32, NodeRef<'src>>Single SoA lookup table keyed by normalized byte position.
Built once at pipeline-build time from the classifier’s emit
stream; entries arrive in strictly increasing position order
because the classifier tiles spans contiguously.
Implementations§
Source§impl<'src> Registry<'src>
impl<'src> Registry<'src>
Sourcepub fn from_sorted_slice(entries: &[(u32, NodeRef<'src>)]) -> Self
pub fn from_sorted_slice(entries: &[(u32, NodeRef<'src>)]) -> Self
Construct a registry from a position-sorted slice of
(position, NodeRef) entries.
§Panics
Inherits [EytzingerMap::from_sorted_slice]’s precondition:
the slice must be sorted by key. The lex pipeline always emits
in source order, so this is satisfied by construction.
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
Empty registry. Useful as a starting point for incremental construction (the lex driver pushes into a builder vec that later collapses into the Eytzinger table).
Sourcepub fn node_at(&self, pos: NormalizedOffset) -> Option<NodeRef<'src>>
pub fn node_at(&self, pos: NormalizedOffset) -> Option<NodeRef<'src>>
Look up the registry entry at the given normalized-text byte
position. Returns None if no sentinel landed at that
position.
The argument is a [NormalizedOffset] newtype rather than a
raw u32 — editor surfaces that hold a source-coordinate byte
offset must first translate via
BorrowedLexOutput::node_at_source (which walks a
source-keyed side-table built during the lex pipeline) instead
of casting between the two coordinate spaces.
Sourcepub fn iter_sorted(&self) -> impl Iterator<Item = (u32, NodeRef<'src>)> + '_
pub fn iter_sorted(&self) -> impl Iterator<Item = (u32, NodeRef<'src>)> + '_
Iterate over (position, NodeRef) entries in ascending
position order. Useful for tests and tooling that want to
enumerate everything the registry holds.
Sourcepub fn iter_kind(
&self,
kind: Sentinel,
) -> impl Iterator<Item = (u32, NodeRef<'src>)> + '_
pub fn iter_kind( &self, kind: Sentinel, ) -> impl Iterator<Item = (u32, NodeRef<'src>)> + '_
Iterate over entries whose NodeRef::sentinel_kind matches
kind. O(n) but the filter is a constant-time variant
discriminant compare.
Sourcepub fn count_kind(&self, kind: Sentinel) -> usize
pub fn count_kind(&self, kind: Sentinel) -> usize
Count entries whose NodeRef::sentinel_kind matches kind.
O(n) over the table. Cardinality assertions in unit tests
drive this; production lookups go through Self::node_at.
Trait Implementations§
Auto Trait Implementations§
impl<'src> Freeze for Registry<'src>
impl<'src> RefUnwindSafe for Registry<'src>
impl<'src> Send for Registry<'src>
impl<'src> Sync for Registry<'src>
impl<'src> Unpin for Registry<'src>
impl<'src> UnsafeUnpin for Registry<'src>
impl<'src> UnwindSafe for Registry<'src>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more