Skip to main content

Module parse_mode

Module parse_mode 

Source
Expand description

Strict vs lossy parse modes + diagnostics.

Audit P1 identified the single most important API discipline problem in rvt-rs: the same method (e.g. RevitFile::summarize) sometimes returned partial results with errors silently swallowed, and sometimes returned clean results — with no way for callers to tell which. That’s fine for a CLI that wants to show whatever it can; it’s dangerous for a library that might be wrapped in a SaaS file-validation pipeline where partial parse = false confidence.

This module introduces the three types that every future strict/lossy pair uses:

  • ParseMode — the intent switch. Strict errors on any parse failure; BestEffort collects diagnostics and returns partial.
  • Diagnostics — warnings + failure records accumulated during a best-effort parse.
  • Decoded<T> — wrapper returned by lossy variants. Pairs the value with its diagnostics + a complete flag.

New methods that follow this pattern are named *_strict and *_lossy to make the choice obvious at the call site. Existing methods that previously had mixed behaviour are aliased to _lossy via #[deprecated] until a later major version cleans them up.

Structs§

Decoded
Wrapper returned by *_lossy parsers.
Diagnostics
Diagnostic accumulator carried by best-effort parse results.
Warning
A single warning accumulated during a best-effort parse.

Enums§

ParseMode
Parser-intent switch for operations that can choose between strict and best-effort behaviour.