IncrementalParser

Struct IncrementalParser 

Source
pub struct IncrementalParser { /* private fields */ }
Available on crate feature stream only.
Expand description

Manages incremental parsing state and delta accumulation

Implementations§

Source§

impl IncrementalParser

Source

pub fn new() -> Self

Create a new incremental parser

Source

pub fn set_reparse_threshold(&mut self, threshold: usize)

Set the reparse threshold in bytes

Source

pub fn initialize_cache(&mut self, content: &str)

Initialize the cache with the current document content This primes the incremental parser for efficient subsequent edits

Source

pub fn has_cached_script(&self) -> bool

Check if there’s a cached script available

Source

pub fn with_cached_script<F, R>(&self, f: F) -> Result<R>
where F: FnOnce(&Script<'_>) -> Result<R>,

Execute a function with the cached script (avoids re-parsing)

Source

pub fn apply_change( &mut self, document_text: &str, range: Range, new_text: &str, ) -> Result<ScriptDeltaOwned>

Apply a change incrementally, returning the delta

Source

pub fn full_reparse(&mut self, content: &str) -> Result<ScriptDeltaOwned>

Force a full reparse of the document

Source

pub fn clear_cache(&mut self)

Clear all cached state

Source

pub fn pending_changes(&self) -> &[DocumentChange<'static>]

Get accumulated changes since last full parse

Source

pub fn should_reparse(&self) -> bool

Check if a full reparse is recommended

Trait Implementations§

Source§

impl Debug for IncrementalParser

Source§

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

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

impl Default for IncrementalParser

Source§

fn default() -> Self

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

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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