pub struct ParseSession<L: Language + Send + Sync + 'static> { /* private fields */ }Expand description
A memory pool that manages the lifecycle of parsing generations.
ParseSession handles the double-buffering of memory arenas (Active vs Old)
to support efficient incremental reuse. It implements ParseCache.
Implementations§
Trait Implementations§
Source§impl<L: Language + Send + Sync + 'static> LexerCache<L> for ParseSession<L>
impl<L: Language + Send + Sync + 'static> LexerCache<L> for ParseSession<L>
Source§fn set_lex_output(&mut self, output: LexOutput<L>)
fn set_lex_output(&mut self, output: LexOutput<L>)
Sets the lexed output in the cache. Read more
Source§fn get_token(&self, index: usize) -> Option<Token<L::TokenType>>
fn get_token(&self, index: usize) -> Option<Token<L::TokenType>>
Gets a token from the cache by index. Read more
Source§fn count_tokens(&self) -> usize
fn count_tokens(&self) -> usize
Gets the total number of tokens in the cache. Read more
Source§fn has_tokens(&self) -> bool
fn has_tokens(&self) -> bool
Checks if the cache contains any tokens. Read more
Source§impl<L: Language + Send + Sync + 'static> ParseCache<L> for ParseSession<L>
impl<L: Language + Send + Sync + 'static> ParseCache<L> for ParseSession<L>
Source§fn arena(&self) -> &SyntaxArena
fn arena(&self) -> &SyntaxArena
Returns the arena for allocating nodes in the current generation.
Source§fn old_tree(&self) -> Option<&GreenNode<'_, L>>
fn old_tree(&self) -> Option<&GreenNode<'_, L>>
Returns the root of the previous tree for incremental parsing.
Source§fn lex_output(&self) -> Option<&LexOutput<L>>
fn lex_output(&self) -> Option<&LexOutput<L>>
Returns the output of the lexing phase.
Source§fn prepare_generation(&mut self)
fn prepare_generation(&mut self)
Prepares for a new parsing generation (e.g. by swapping arenas).
Source§fn commit_generation(&self, root: &GreenNode<'_, L>)
fn commit_generation(&self, root: &GreenNode<'_, L>)
Commits the result of a parsing generation.
impl<L: Language + Send + Sync + 'static> BuilderCache<L> for ParseSession<L>
impl<L: Language + Send + Sync + 'static> Send for ParseSession<L>
impl<L: Language + Send + Sync + 'static> Sync for ParseSession<L>
Auto Trait Implementations§
impl<L> !Freeze for ParseSession<L>
impl<L> !RefUnwindSafe for ParseSession<L>
impl<L> Unpin for ParseSession<L>
impl<L> !UnwindSafe for ParseSession<L>
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
Mutably borrows from an owned value. Read more