pub struct ParseConfig {
pub reject_unknown: bool,
pub abort_on_error: bool,
pub max_group_depth: usize,
}Expand description
Parse-time configuration knobs.
ParseConfig is plain data describing how a single parse call should
behave. It is independent of ParseContext, which
owns the knowledge base; the same context can be reused across many calls
with different configs.
Two orthogonal axes control parsing, both with true = stricter:
reject_unknown: unknown command/environment names become diagnostics (true) orknown: falsenodes (false).abort_on_error: stop at the first error (true) or continue parsing to collect every diagnostic (false, slower). Recovery may return a read-only document containingErrornodes; useParseResult::try_into_documentwhen downstream code requires a complete tree.
Named extremes STRICT and LENIENT cover
the two corners where both axes agree. For mixed settings, use struct-update
syntax, e.g. ParseConfig { reject_unknown: true, ..Default::default() }.
Fields§
§reject_unknown: boolWhen true, unknown command/environment names become diagnostics
instead of being preserved as known: false nodes.
This controls unknown-name handling only, not general error strictness.
abort_on_error: boolWhen true, parsing stops at the first error in each content item and
may return no document for that item.
When false, the parser uses recovery fallbacks to collect every
diagnostic (useful for IDEs and playgrounds, but slower on large corpora)
and may attach Error nodes to the returned document. A document with
error nodes is read-only and cannot be used by transform entry points.
max_group_depth: usizeHard upper bound on nested { ... } brace group depth.
Implementations§
Source§impl ParseConfig
impl ParseConfig
Sourcepub const DEFAULT_MAX_GROUP_DEPTH: usize = 128
pub const DEFAULT_MAX_GROUP_DEPTH: usize = 128
Default hard upper bound on nested { ... } brace group depth.
Trait Implementations§
Source§impl Clone for ParseConfig
impl Clone for ParseConfig
Source§fn clone(&self) -> ParseConfig
fn clone(&self) -> ParseConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseConfig
impl Debug for ParseConfig
Source§impl Default for ParseConfig
impl Default for ParseConfig
impl Eq for ParseConfig
Source§impl PartialEq for ParseConfig
impl PartialEq for ParseConfig
Source§fn eq(&self, other: &ParseConfig) -> bool
fn eq(&self, other: &ParseConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ParseConfig
Auto Trait Implementations§
impl Freeze for ParseConfig
impl RefUnwindSafe for ParseConfig
impl Send for ParseConfig
impl Sync for ParseConfig
impl Unpin for ParseConfig
impl UnsafeUnpin for ParseConfig
impl UnwindSafe for ParseConfig
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.