#[non_exhaustive]pub struct ParseOptions {
pub on_malformed_record: OnMalformed,
pub check_references: bool,
pub accept_real_without_point: 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.
accept_real_without_point: boolWhether a data-section real written without its decimal point
(1E-05) is read as a real. Off by default; see
Self::accept_real_without_point.
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, and read reals
written without their decimal point (see
Self::accept_real_without_point).
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.
Sourcepub const fn accept_real_without_point(self, enabled: bool) -> ParseOptions
pub const fn accept_real_without_point(self, enabled: bool) -> ParseOptions
Enables or disables reading reals written without a decimal point.
ISO 10303-21 writes a real as [sign] digits "." [digits] [exponent], but some exporters omit the point before an exponent
(1E-05, -2E3, 3e+2), including buildingSMART’s own IFC4.x
alignment test files. Strict parsing refuses such a number with an
error for which StepError::is_real_without_point
holds. When enabled, a data record keeps it as the real it means,
with the point inserted (1.E-05), and yields one
DiagnosticKind::RealWithoutPoint over the number’s bytes. The
stored value carries the point, so writing the model back produces
valid Part 21.
Only complete numbers are read: 1E, 1E- and 1EE2 stay errors,
as do numbers without leading digits such as .5E2. Text inside
strings is never touched. The header section stays strict, as it does
for every other recovery.
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