Struct ScriptInfoParser

Source
pub struct ScriptInfoParser<'a> { /* private fields */ }
Expand description

Parser for [Script Info] section content

Parses key-value pairs from the script info section and handles special fields like ScriptType that affect parsing behavior.

§Performance

  • Time complexity: O(n) for n lines in section
  • Memory: Zero allocations via lifetime-generic spans
  • Target: <0.5ms for typical script info sections

Implementations§

Source§

impl<'a> ScriptInfoParser<'a>

Source

pub fn new(source: &'a str, start_position: usize, start_line: usize) -> Self

Create new script info parser for source text

§Arguments
  • source - Source text to parse
  • start_position - Starting byte position in source
  • start_line - Starting line number for error reporting
Source

pub fn parse(self) -> ParseResult<ScriptInfoParseResult<'a>>

Parse script info section content

Returns the parsed section and any issues encountered during parsing. Handles ScriptType field detection and version updating.

§Returns

Tuple of (parsed_section, detected_version, parse_issues, final_position, final_line)

§Errors

Returns an error if the script info section contains malformed key-value pairs or other unrecoverable syntax errors.

Source

pub fn issues(self) -> Vec<ParseIssue>

Get accumulated parse issues

Auto Trait Implementations§

§

impl<'a> Freeze for ScriptInfoParser<'a>

§

impl<'a> RefUnwindSafe for ScriptInfoParser<'a>

§

impl<'a> Send for ScriptInfoParser<'a>

§

impl<'a> Sync for ScriptInfoParser<'a>

§

impl<'a> Unpin for ScriptInfoParser<'a>

§

impl<'a> UnwindSafe for ScriptInfoParser<'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.