Struct Pipeline
pub struct Pipeline<'src, 'a, S> {
source: &'src str,
arena: &'a Arena,
diagnostics: Vec<Diagnostic>,
state: S,
_arena: PhantomData<&'a Arena>,
}Expand description
Type-state lex pipeline. Each state’s transition method consumes
self, materialises its phase output into the next state struct,
and returns a new pipeline in the next state.
Fields§
§source: &'src str§arena: &'a Arena§diagnostics: Vec<Diagnostic>§state: S§_arena: PhantomData<&'a Arena>Implementations§
§impl<'src, 'a> Pipeline<'src, 'a, Source>
impl<'src, 'a> Pipeline<'src, 'a, Source>
pub fn new(source: &'src str, arena: &'a Arena) -> Pipeline<'src, 'a, Source>
pub fn new(source: &'src str, arena: &'a Arena) -> Pipeline<'src, 'a, Source>
Wrap a source string for type-state-driven lex. Phase 0 has not
yet run; only source and arena are set.
pub fn run_to_completion(
source: &'src str,
arena: &'a Arena,
) -> BorrowedLexOutput<'a>
pub fn run_to_completion( source: &'src str, arena: &'a Arena, ) -> BorrowedLexOutput<'a>
One-shot driver: run every phase and return the final
BorrowedLexOutput. Equivalent to crate::lex_into_arena.
§impl<'src, 'a> Pipeline<'src, 'a, Sanitized<'a>>
impl<'src, 'a> Pipeline<'src, 'a, Sanitized<'a>>
pub fn sanitized_text(&self) -> &'a str
pub fn sanitized_text(&self) -> &'a str
Sanitized text (arena-allocated).
pub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Diagnostics accumulated through Phase 0.
pub fn tokenize(self) -> Pipeline<'src, 'a, Tokenized<'a>>
pub fn tokenize(self) -> Pipeline<'src, 'a, Tokenized<'a>>
Run Phase 1 (tokenize). Materialises the full
BumpVec<'a, Token> inside arena via tokenize_in.
§impl<'a> Pipeline<'_, 'a, Paired<'a>>
impl<'a> Pipeline<'_, 'a, Paired<'a>>
pub fn events(&self) -> &[PairEvent]
pub fn events(&self) -> &[PairEvent]
Borrow the materialised pair-event list. Useful for inspection
before .build().
pub fn links(&self) -> &[PairLink]
pub fn links(&self) -> &[PairLink]
Borrow the resolved (open, close) pair side-table. Useful for
inspection before .build().
pub fn build(self) -> BorrowedLexOutput<'a>
pub fn build(self) -> BorrowedLexOutput<'a>
Drive Phase 3 + the arena normalizer fold and return the final
BorrowedLexOutput. Terminal transition because
&mut BorrowedAllocator cannot be safely held across an external
pause without locking the pipeline into a single thread for the
allocator’s lifetime.
§Diagnostic order
Sanitize (Phase 0) → Pair (Phase 2 unclosed/unmatched) →
Classify (Phase 3 unknown annotations etc.). Matches the
pre-Pipeline lex_into_arena ordering.
§Panics
Panics if the sanitized source exceeds u32::MAX bytes
(the lexer’s Span width contract). In practice unreachable;
Phase 0 caps source length at the same boundary.
Trait Implementations§
Auto Trait Implementations§
impl<'src, 'a, S> Freeze for Pipeline<'src, 'a, S>where
S: Freeze,
impl<'src, 'a, S> !RefUnwindSafe for Pipeline<'src, 'a, S>
impl<'src, 'a, S> !Send for Pipeline<'src, 'a, S>
impl<'src, 'a, S> !Sync for Pipeline<'src, 'a, S>
impl<'src, 'a, S> Unpin for Pipeline<'src, 'a, S>where
S: Unpin,
impl<'src, 'a, S> UnsafeUnpin for Pipeline<'src, 'a, S>where
S: UnsafeUnpin,
impl<'src, 'a, S> !UnwindSafe for Pipeline<'src, 'a, S>
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<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