Skip to main content

Module codec

Module codec 

Source
Expand description

The serialization seam.

§Why a trait, and why it lives here

IFC is a data model with several concrete encodings: STEP physical file (.ifc), ifcXML (.ifcxml), and prospectively IFC-JSON. They differ only in syntax — the entity graph is identical.

Defining Codec in ifc-model means:

  • the data model never depends on any particular encoding;
  • a new encoding is a new crate implementing this trait, with no change here and no change to any consumer;
  • conversion between encodings is free — parse with one, write with another, because both speak Model.

The inverse layering (a model that depends on the STEP reader) would make ifcXML support a second parallel stack and make cross-format conversion lossy.

Traits§

Codec
Read and write one concrete IFC serialization.