#[non_exhaustive]pub struct ParseOptions {
pub on_malformed_record: OnMalformed,
pub check_references: bool,
}Expand description
Malformed-record policy, re-exported so consumers need not depend on
openbim-step directly to configure a reader.
Parse behavior toggles.
Constructed with ParseOptions::default (strict) and adjusted through
ParseOptions::on_malformed_record, so later options cannot break
existing call sites.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.on_malformed_record: OnMalformedPolicy for unparsable data records.
check_references: boolWhether to report duplicate instance ids and references to ids that are never defined. Off by default: strict parsing means syntax only.
Implementations§
Source§impl ParseOptions
impl ParseOptions
Sourcepub const fn strict() -> ParseOptions
pub const fn strict() -> ParseOptions
Strict options: any malformed record aborts the parse.
Sourcepub const fn lenient() -> ParseOptions
pub const fn lenient() -> ParseOptions
Options that skip and report malformed data records.
Sourcepub const fn on_malformed_record(self, policy: OnMalformed) -> ParseOptions
pub const fn on_malformed_record(self, policy: OnMalformed) -> ParseOptions
Sets the malformed-record policy.
Sourcepub const fn check_references(self, enabled: bool) -> ParseOptions
pub const fn check_references(self, enabled: bool) -> ParseOptions
Enables or disables reference-integrity diagnostics.
When enabled, every data record whose instance id was already defined
yields a DiagnosticKind::DuplicateId, and every record referencing
an id that no record in the DATA section defines yields one
DiagnosticKind::DanglingReference per distinct missing id. Forward
references are legal (ISO 10303-21:2016 §11.2) and are only reported
if the target is still undefined at ENDSEC. Ids compare numerically,
so #07 and #7 name the same instance.
Nothing is dropped or rewritten, so these diagnostics never make an
outcome lossy. The check keeps one entry per defined id, so memory is
linear in the number of records, including for crate::parse_events_with.
Trait Implementations§
Source§impl Clone for ParseOptions
impl Clone for ParseOptions
Source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more