Skip to main content

SchemaVersion

Enum SchemaVersion 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

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.

Source

pub const fn release_id(self) -> &'static str

Exact published release identifier for the bundled structural table.

Examples found in repository?
examples/export_structural_catalog.rs (line 59)
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}
Source

pub const fn expected_entity_count(self) -> usize

Entity count asserted when the bundled artifact is generated.

Source

pub const fn expected_type_count(self) -> usize

Defined-type count asserted when the bundled artifact is generated.

Source

pub const fn header_tokens(self) -> &'static [&'static str]

Header tokens accepted for this release, excluding case-only variants.

Source

pub const fn feature_name(self) -> &'static str

The ifc-schema cargo feature that bundles this release’s table.

Source

pub const fn is_bundled(self) -> bool

Whether this build bundles this release’s table, i.e. whether for_version(self) succeeds.

Source

pub fn from_header_token(token: &str) -> Option<Self>

Parse the token found in a STEP file’s FILE_SCHEMA header entry.

Trait Implementations§

Source§

impl Clone for SchemaVersion

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SchemaVersion

Source§

impl Debug for SchemaVersion

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SchemaVersion

Source§

impl Hash for SchemaVersion

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for SchemaVersion

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SchemaVersion

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.