pub struct Parser { /* private fields */ }Expand description
Parser configuration.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn threads(self, threads: impl Into<Option<usize>>) -> Self
pub fn threads(self, threads: impl Into<Option<usize>>) -> Self
Set number of threads (None = use all available)
Sourcepub const fn capture_source(self) -> Self
pub const fn capture_source(self) -> Self
Capture source spans for blocks.
Sourcepub const fn preserve_raw(self) -> Self
pub const fn preserve_raw(self) -> Self
Preserve exact raw source text in parsed-document output.
Sourcepub const fn expand_values(self) -> Self
pub const fn expand_values(self) -> Self
Populate expanded value text in parsed-document output.
Sourcepub fn parse_document<'a>(&self, input: &'a str) -> Result<ParsedDocument<'a>>
pub fn parse_document<'a>(&self, input: &'a str) -> Result<ParsedDocument<'a>>
Parse a single input string into the parsed document model.
Use this when a caller needs source-order blocks, diagnostics, raw-text
slots, or partial parse results. Use Self::parse for the compact
Library API.
Sourcepub fn parse_source<'a>(
&self,
source_name: impl Into<Cow<'a, str>>,
input: &'a str,
) -> Result<ParsedDocument<'a>>
pub fn parse_source<'a>( &self, source_name: impl Into<Cow<'a, str>>, input: &'a str, ) -> Result<ParsedDocument<'a>>
Parse a named source into the parsed document model.
The parser does not read files itself; callers provide the source name or path-like label together with the already-loaded input text.
Sourcepub fn parse_sources<'a>(
&self,
sources: &[CorpusSource<'a>],
) -> Result<ParsedCorpus<'a>>
pub fn parse_sources<'a>( &self, sources: &[CorpusSource<'a>], ) -> Result<ParsedCorpus<'a>>
Parse multiple named in-memory sources into a corpus result.
Sourcepub fn parse_events<'a, F>(
&self,
input: &'a str,
on_event: F,
) -> Result<StreamingSummary>
pub fn parse_events<'a, F>( &self, input: &'a str, on_event: F, ) -> Result<StreamingSummary>
Stream parsed source-order events to a callback.
Strict mode returns an error on the first malformed block. Tolerant mode
emits recovered partial entries or failed blocks with diagnostics and
continues. The callback can return ParseFlow::Stop to stop after the
current event; the returned summary then has stopped = true.
Sourcepub fn parse_source_events<'a, F>(
&self,
source_name: impl Into<Cow<'a, str>>,
input: &'a str,
on_event: F,
) -> Result<StreamingSummary>
pub fn parse_source_events<'a, F>( &self, source_name: impl Into<Cow<'a, str>>, input: &'a str, on_event: F, ) -> Result<StreamingSummary>
Stream parsed source-order events from a named source.
Sourcepub fn parse_corpus_events<'a, F>(
&self,
sources: &[CorpusSource<'a>],
on_event: F,
) -> Result<StreamingSummary>
pub fn parse_corpus_events<'a, F>( &self, sources: &[CorpusSource<'a>], on_event: F, ) -> Result<StreamingSummary>
Stream events from multiple named in-memory sources in corpus order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
impl UnwindSafe for Parser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more