ZeroScanner

Struct ZeroScanner 

Source
pub struct ZeroScanner<'a> {
    input: &'a str,
    pub position: Position,
    char_index: usize,
    char_indices: Vec<(usize, char)>,
    token_pool: TokenPool<'a>,
}
Expand description

Zero-copy string scanner that operates on slices

Fields§

§input: &'a str

Reference to the input string

§position: Position

Current position in the input

§char_index: usize

Current character index

§char_indices: Vec<(usize, char)>

Cached character indices for faster access

§token_pool: TokenPool<'a>

Token pool for allocation optimization

Implementations§

Source§

impl<'a> ZeroScanner<'a>

Source

pub fn new(input: &'a str) -> Self

Create a new zero-copy scanner

Source

pub fn current_char(&self) -> Option<char>

Get the current character

Source

pub fn advance(&mut self) -> Option<char>

Advance to the next character

Source

pub fn peek_char(&self, offset: isize) -> Option<char>

Peek at a character at the given offset

Source

pub fn slice_from(&self, start_position: Position) -> Result<&'a str>

Get a slice of the input from start position to current position

Source

pub fn slice_between(&self, start: Position, end: Position) -> Result<&'a str>

Get a slice between two positions

Source

pub fn reset(&mut self)

Reset the scanner to the beginning

Source

pub fn stats(&self) -> ScannerStats

Get scanner statistics for performance monitoring

Source

pub fn scan_plain_scalar_zero_copy(&mut self) -> Result<ZeroToken<'a>>

Scan a plain scalar using zero-copy slicing

Source

pub fn scan_identifier_zero_copy(&mut self) -> Result<ZeroString<'a>>

Scan a simple identifier using zero-copy slicing (for anchors/aliases)

Source

pub fn skip_whitespace(&mut self)

Skip whitespace efficiently

Auto Trait Implementations§

§

impl<'a> Freeze for ZeroScanner<'a>

§

impl<'a> RefUnwindSafe for ZeroScanner<'a>

§

impl<'a> Send for ZeroScanner<'a>

§

impl<'a> Sync for ZeroScanner<'a>

§

impl<'a> Unpin for ZeroScanner<'a>

§

impl<'a> UnwindSafe for ZeroScanner<'a>

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.