Skip to main content

ExpressRules

Struct ExpressRules 

Source
pub struct ExpressRules { /* private fields */ }
Expand description

The WHERE rules, type rules, global rules and functions of one IFC release, ready to evaluate.

§Where the rule text comes from

The IFC schemas are published by buildingSMART under CC BY-ND 4.0, and this crate does not redistribute them or anything derived from their rule text: the bundled tables carry rule labels only. The caller supplies the release’s .exp file – scripts/fetch-ifc-schemas.sh fetches and checksums the five releases – and this type reads it at run time.

§Pairing with the tables

The text must declare the same schema as the bundled tables it is paired with, and agree with them on every entity’s attribute layout: ExpressRules::parse refuses IFC4.exp paired with IFC4X3 tables, and a modified file whose slots would be read wrong.

Cheap to clone: the parsed schema is shared. Send and Sync, so one parse serves every thread.

Implementations§

Source§

impl ExpressRules

Source

pub fn parse(source: &str, schema: &Schema) -> Result<Self, ExpressError>

Reads source, the EXPRESS text of schema’s release.

§Errors

ExpressError when the text does not parse, names another schema, disagrees with the tables, or uses a name that binds to nothing.

Source

pub fn parse_bytes(bytes: &[u8], schema: &Schema) -> Result<Self, ExpressError>

Reads EXPRESS text that is not UTF-8.

The normative IFC files are ASCII, but some copies are Latin-1 (a ° in a remark); each byte is read as one character, which is exact for everything outside remarks and string literals.

§Errors

As Self::parse.

Source

pub fn with_limits(self, limits: EvalLimits) -> Self

The same rules evaluated under other limits.

Source

pub fn limits(&self) -> EvalLimits

The limits evaluation runs under.

Source

pub fn schema_name(&self) -> &str

The schema name the text declares (IFC4X3_ADD2).

Source

pub fn rule_ids(&self) -> impl Iterator<Item = &str>

Every rule id these rules can report, sorted: Entity.Label for an entity WHERE rule, Type.Label for a type WHERE rule, and global.Rule for a global rule.

Source

pub fn covers(&self, id: &str) -> bool

Whether these rules report under id; a hand-written rule with the same id is superseded by them.

Source

pub fn coverage(&self) -> Coverage

How many declarations this evaluator can evaluate, and which it cannot, by name.

Trait Implementations§

Source§

impl Clone for ExpressRules

Source§

fn clone(&self) -> ExpressRules

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 Debug for ExpressRules

Source§

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

Formats the value using the given formatter. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.