#[non_exhaustive]pub enum SchemaVersion {
Ifc2x3,
Ifc4,
Ifc4x1,
Ifc4x2,
Ifc4x3,
}Expand description
Which IFC schema version a table describes.
#[non_exhaustive]: a release added later is a new variant, and a
consumer’s match must say what it does with a release it has not
proven – refuse it, never alias it to a neighbour.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ifc2x3
IFC2x3 TC1 — 653 entities. Still the most common in the wild.
Ifc4
IFC4 ADD2 TC1 — 776 entities. The ISO-standard release.
Ifc4x1
IFC4x1 FINAL — 801 entities. Adds alignment (IfcAlignment and its
curves) to IFC4.
Ifc4x2
IFC4x2 FINAL — 816 entities. Adds bridges (IfcBridge, IfcFacility)
to IFC4x1.
Ifc4x3
IFC4x3 ADD2 — 876 entities. Adds alignment and civil infrastructure.
Implementations§
Source§impl SchemaVersion
impl SchemaVersion
Sourcepub const ALL: [Self; 5]
pub const ALL: [Self; 5]
Every version this crate knows, oldest first.
Which of them have bundled tables in a given build is a separate
question; see for_version.
Sourcepub const fn release_id(self) -> &'static str
pub const fn release_id(self) -> &'static str
Exact published release identifier for the bundled structural table.
Examples found in repository?
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let requested = env::args().nth(1).ok_or_else(|| {
12 io::Error::new(
13 io::ErrorKind::InvalidInput,
14 "usage: cargo run -p ifc-schema --example export_structural_catalog -- <ifc2x3|ifc4|ifc4x1|ifc4x2|ifc4x3> [--direct]",
15 )
16 })?;
17 let version = match requested.to_ascii_lowercase().as_str() {
18 "ifc2x3" | "ifc2x3_tc1" => SchemaVersion::Ifc2x3,
19 "ifc4" | "ifc4_add2_tc1" => SchemaVersion::Ifc4,
20 "ifc4x1" | "ifc4x1_final" => SchemaVersion::Ifc4x1,
21 "ifc4x2" | "ifc4x2_final" => SchemaVersion::Ifc4x2,
22 "ifc4x3" | "ifc4x3_add2" => SchemaVersion::Ifc4x3,
23 _ => {
24 return Err(io::Error::new(
25 io::ErrorKind::InvalidInput,
26 format!("unsupported bundled IFC release: {requested}"),
27 )
28 .into());
29 }
30 };
31
32 let direct = match env::args().nth(2).as_deref() {
33 None => false,
34 Some("--direct") => true,
35 Some(value) => {
36 return Err(io::Error::new(
37 io::ErrorKind::InvalidInput,
38 format!("unsupported export option: {value}"),
39 )
40 .into());
41 }
42 };
43 if env::args().nth(3).is_some() {
44 return Err(io::Error::new(io::ErrorKind::InvalidInput, "too many arguments").into());
45 }
46
47 let stdout = io::stdout();
48 let mut output = BufWriter::new(stdout.lock());
49 let summary = if direct {
50 write_direct_structural_catalog(version, &mut output)?
51 } else {
52 write_structural_catalog(version, &mut output)?
53 };
54 output.flush()?;
55 eprintln!(
56 "exported {} entities and {} types for {}",
57 summary.entity_rows,
58 summary.type_count,
59 version.release_id()
60 );
61 Ok(())
62}Sourcepub const fn expected_entity_count(self) -> usize
pub const fn expected_entity_count(self) -> usize
Entity count asserted when the bundled artifact is generated.
Sourcepub const fn expected_type_count(self) -> usize
pub const fn expected_type_count(self) -> usize
Defined-type count asserted when the bundled artifact is generated.
Sourcepub const fn header_tokens(self) -> &'static [&'static str]
pub const fn header_tokens(self) -> &'static [&'static str]
Header tokens accepted for this release, excluding case-only variants.
Sourcepub const fn feature_name(self) -> &'static str
pub const fn feature_name(self) -> &'static str
The ifc-schema cargo feature that bundles this release’s table.
Sourcepub const fn is_bundled(self) -> bool
pub const fn is_bundled(self) -> bool
Whether this build bundles this release’s table, i.e. whether
for_version(self) succeeds.
Sourcepub fn from_header_token(token: &str) -> Option<Self>
pub fn from_header_token(token: &str) -> Option<Self>
Parse the token found in a STEP file’s FILE_SCHEMA header entry.