pub enum Primitive {
Real,
Integer,
Text,
Boolean,
Logical,
Binary,
}Expand description
The EXPRESS primitive a defined type bottoms out in.
Variants§
Real
REAL or NUMBER.
Integer
INTEGER.
Text
STRING.
Boolean
BOOLEAN.
Logical
LOGICAL – true, false, or unknown.
Binary
BINARY.
Implementations§
Source§impl Primitive
impl Primitive
Sourcepub fn from_resolved(resolved: &str) -> Option<Self>
pub fn from_resolved(resolved: &str) -> Option<Self>
Recognizes an EXPRESS primitive from a resolved type expression.
The resolved text may carry aggregate syntax (LIST [1:?] OF REAL)
and width specifications (STRING(255), STRING(22) FIXED); the
last primitive keyword is the one the value must satisfy, and text
naming no primitive yields None rather than a guess.
Width and FIXED are skipped rather than read as the trailing token:
IFC4 declares IfcLabel and IfcIdentifier as STRING(255), so a
trailing-token reading left every Name slot unchecked.
Sourcepub fn accepts(self, value: &Value) -> bool
pub fn accepts(self, value: &Value) -> bool
Whether value is written in a form this primitive accepts.
An INTEGER is accepted where a REAL is declared: Part 21 writes
1. and 1 for the same quantity depending on the writer, and
rejecting the integer spelling would fail almost every real file.
The reverse is not accepted – 1.5 is not an INTEGER.