ifc_model/lib.rs
1//! `ifc-model` — the IFC entity graph, free of both domain semantics and
2//! serialization.
3//!
4//! # The two separations this crate exists to enforce
5//!
6//! **1. Model vs. domain meaning.** [`Model`] stores entities. It does not know
7//! what a cost item, a task, a wall, or a material *is*. Domain crates
8//! (`ifc-cost`, `ifc-schedule`, `ifc-properties`, ...) borrow a `&Model` and
9//! interpret it. Consequences:
10//!
11//! - a thin application compiles only the domains it uses;
12//! - **data we do not understand still round-trips perfectly**, because it is
13//! stored structurally rather than as a domain struct. A file full of cost
14//! entities parses and re-exports intact in a build with no cost crate at
15//! all. This is verified by `tests/roundtrip.rs`.
16//!
17//! **2. Model vs. serialization.** [`Model`] is not "the STEP model". STEP,
18//! ifcXML and a prospective IFC-JSON are encodings of the same graph, and each
19//! is a separate crate implementing [`codec::Codec`]. Nothing here depends on
20//! any of them — which is why format conversion is just "read with one, write
21//! with another".
22//!
23//! ```text
24//! ifc-step ──┐ ┌── ifc-cost
25//! ifc-xml ──┼── Codec ──> Model <────┼── ifc-schedule (views)
26//! ifc-json ──┘ (this crate) └── ifc-properties
27//! ```
28//!
29//! # Modules
30//!
31//! | Module | Role |
32//! | --- | --- |
33//! | [`value`] | The serialization-independent value model |
34//! | [`entity`] | Type name plus positional attributes |
35//! | [`model`] | Storage, ordering, type index, reference integrity |
36//! | [`header`] | File metadata and the declared schema token |
37//! | [`codec`] | The read/write trait every serialization implements |
38//! | [`guid`] | IFC's base-64 GlobalId encoding |
39//! | [`diagnostic`] | Non-fatal findings a codec attaches after a recovered read |
40//! | `index` | Derived indices: inverse references |
41//! | [`mutation`] | Transactional authoring: staged edits, preflight, commit |
42//! | `relation` | Structural relationship traversal (no domain meaning) |
43//! | `spatial` | The spatial containment tree |
44//! | `traverse` | Graph walks over references |
45//! | [`error`] | Failure modes |
46
47#[cfg(feature = "authored-dump")]
48pub mod authored_dump;
49pub mod codec;
50pub mod diagnostic;
51pub mod entity;
52pub mod error;
53pub mod guid;
54pub mod header;
55pub mod index;
56mod lazy;
57pub mod model;
58pub mod mutation;
59mod provenance;
60mod relation;
61mod spatial;
62pub mod traverse;
63pub mod value;
64
65pub use codec::Codec;
66pub use diagnostic::{Diagnostic, Severity};
67pub use entity::Entity;
68pub use error::{ModelError, ModelResult};
69pub use header::Header;
70pub use index::{Referrer, ReverseIndex};
71pub use lazy::EntitySource;
72pub use model::Model;
73pub use mutation::{Applied, Conflict, Edit, Transaction};
74pub use traverse::{breadth_first, depth_first, find_cycle, Budget, Stop, Walk};
75pub use value::{EntityId, Value};