Engineering rationale for IFC Inspector — written for code reviewers, recruiters, and future maintainers.
Format inspired by Architecture Decision Records (ADR): context, decision, consequences.
Context. Rust IFC crates (ifc-rs, etc.) exist but pull large schema bindings, often with C dependencies. The primary use case is type and property inspection, not geometry.
Decision. Implement a focused STEP tokenizer and extract only coordination-relevant entities.
Consequences.
| ✅ Pros | ❌ Cons |
|---|---|
| Zero C ABI / linking complexity | Not a full IFC implementation |
#![forbid(unsafe_code)] end-to-end |
Schema edge cases need manual handling |
| Portfolio demonstrates parser craft | Geometry permanently out of scope |
| Binary stays small | Must maintain attribute index knowledge |
Context. BIM coordinators ask “how many types of X?” before “where is instance #4521?” Revit, Navisworks, and Solibri default to 3D views — overkill for counting and property audits.
Decision. Three-panel dashboard: Levels → Categories → Types, with drill-down to instances.
Consequences.
- Matches professional audit workflow
- Instance browser is secondary (Type Detail → Enter)
- Counts and filters are type-centric
Context. Early versions stored parallel maps: element_to_storey, element_properties, instance_global_ids. Three maps = three merge policies and JSON leak risk.
Decision. One HashMap<u64, Instance> with all per-instance fields.
Consequences.
- Simpler library API and export logic
- Storey and property queries go through
instances.get(id) - Categories still hold
ElementTypeaggregates for the type browser
Context. Storey filtering logic originally lived in App methods called every frame from Ratatui — coupling UI to spatial topology.
Decision. model/query.rs with ProjectView — pure filtering over IfcProject.
Consequences.
- Unit-testable without terminal
- UI becomes thin: selection state + draw calls
- Library users get same filter semantics as TUI
Context. serde on IfcProject exposed internal STEP IDs, redundant maps, and empty legacy fields — bad for Power BI and public API stability.
Decision. ExportProject in export/dto.rs — explicit, documented JSON schema.
Consequences.
- Stable external contract
- Extra mapping step at export time (negligible cost)
- CSV remains a separate, simpler format
Context. Instance Browser sorts by elevation. Highlighting by display index broke when sort order differed from instance_ids vector order.
Decision. selected_instance_id: Option<u64> everywhere; sort is presentation-only.
Consequences.
- Correct selection after sort
- Slightly more lookup work (ID → position) — irrelevant at inspection scale
Context. Many real exports lack IfcRelDefinesByType for some elements. Hiding them produces falsely low counts.
Decision. Scan instance entities; unlinked ones → Untyped category with synthetic type names.
Consequences.
- Honest totals for auditors
- May expose data quality issues in upstream authoring — feature, not bug
Context. Tests were previously archived; .gitignore excluded all *.ifc. Portfolio claim “custom parser” was unverifiable.
Decision. tests/fixtures/sample.ifc committed; gitignore allows !tests/fixtures/*.ifc only.
Consequences.
- CI proves parser works without user-supplied models
- Fixture must stay minimal (IP-clean, small)
Context. Portfolio code should demonstrate Rust discipline, not just “compiles.”
Decision. Cargo.toml lints: clippy::all = deny, pedantic = warn, CI enforces -D warnings.
Consequences.
- Higher bar for contributions
- Justified
allowentries documented inCargo.toml(e.g.too_many_linesfor parser match arms)
Context. IFC tools often over-promise (“full IFC support”). Reviewers catch this quickly.
Decision. Document non-goals in IFC Domain and here.
Non-goals:
- Geometry / visualization
- IFC write path
- Full schema coverage
- Multi-line STEP records (for now)
Consequences.
- Clear scope for contributors
- Honest positioning in README and interviews
| Alternative | Why rejected |
|---|---|
| Python + IfcOpenShell wrapper | Hides parser work; heavy runtime; not portfolio Rust signal |
| Web viewer (Three.js + wasm) | Different product; geometry-focused |
| Parse everything into generic JSON | Loses type browser semantics; huge files |
| Runtime plugin system | Over-engineering for v0.1 scope |
- Architecture — how decisions map to modules
- IFC Domain — parser coverage details
- API Reference — public surface