Skip to main content

ScannerEngine

Enum ScannerEngine 

#[non_exhaustive]
pub enum ScannerEngine { Meta, Lazy, Dense, }
Expand description

Which concrete regex-automata engine drives the fast (look-around-free) partition. Provisional knob (see LarkOptions::scanner_engine); the merge semantics (MatchKind::LeftmostFirst, anchored-at-pos span search) and the resulting token stream are byte-identical across all three — only the build-time / warm-scan / resident-memory trade differs.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Meta

regex-automata meta Regex — internally a lazy/hybrid DFA with an optimizer-picked engine and a built-in cache pool. Cheap construction, WASM-friendly. Opt-in fallback since the tail-risk bench flipped the default to Lazy: on every measured grammar including a deliberately cache-thrashing adversarial one, Lazy was faster, and Meta degraded worse under the stress that was supposed to be its advantage.

§

Lazy

regex-automata hybrid (lazy) DFA driven directly, with a per-scanner Cache pool (8 MiB cap) for &self access. Skips the meta optimizer’s per-search engine choice; construction stays cheap (the DFA is built lazily during the scan) at the cost of a cache-fill transient. The shipping default — 8-25 % faster warm than Meta with neutral-to-lower resident memory.

§

Dense

regex-automata dense DFA (fully materialized at build time). Fastest warm scan on small alphabets, but determinization over \w-class terminals blows up construction time and resident memory on large grammars (python).

Implementations§

§

impl ScannerEngine

pub fn from_env() -> ScannerEngine

The engine selected by the HL_ENGINE environment hook (meta|lazy| dense), or the enum default (ScannerEngine::Lazy) when unset/unrecognised. Public so out-of-façade harnesses (the conformance corpus A/B, benches) exercise the same engine the process default resolves to. HL_ENGINE is sampled once per process and cached, so a later env change is ignored; pass an explicit engine to Scanner::new_with_engine for a deterministic choice.

Trait Implementations§

§

impl Clone for ScannerEngine

§

fn clone(&self) -> ScannerEngine

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
§

impl Copy for ScannerEngine

§

impl Debug for ScannerEngine

§

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

Formats the value using the given formatter. Read more
§

impl Default for ScannerEngine

§

fn default() -> ScannerEngine

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

impl Eq for ScannerEngine

§

impl PartialEq for ScannerEngine

§

fn eq(&self, other: &ScannerEngine) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for ScannerEngine

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.

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 = !

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.