pub enum Value {
Null,
Derived,
Bool(bool),
LogicalUnknown,
Integer(i64),
Real(f64),
Text(Arc<str>),
Binary(Arc<str>),
Enum(Arc<str>),
Ref(EntityId),
List(Vec<Value>),
Typed {
type_name: Arc<str>,
value: Box<Value>,
},
}Expand description
One attribute slot in an entity.
This is deliberately a structural representation: it records what the file said, not what it means. Interpretation is the job of the domain crates.
Variants§
Null
$ — the attribute is not set.
Derived
* — inherited/derived in a supertype; distinct from $.
Bool(bool)
.T. / .F.
LogicalUnknown
.U. — logical unknown, the third STEP boolean state.
Integer(i64)
An integer literal.
Real(f64)
A real literal.
Text(Arc<str>)
A quoted string, already unescaped to UTF-8.
Binary(Arc<str>)
A binary literal ("0123ABC").
Enum(Arc<str>)
An unquoted enumeration constant such as .ELEMENT.
Ref(EntityId)
A reference to another entity by its in-file id (#42).
List(Vec<Value>)
An ordered aggregate: list, set, array or bag.
Typed
A typed wrapper such as IFCLENGTHMEASURE(2.5).
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_ref_id(&self) -> Option<EntityId>
pub fn as_ref_id(&self) -> Option<EntityId>
The referenced entity, if this value is a reference.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
The boolean, if this value is .T. or .F..
.U. (logical unknown) returns None: it is a third state, not a
missing boolean, and collapsing it to either would lose that.
Sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
The integer, if this value is an integer literal.
Does not accept a real: IFC distinguishes IfcInteger from IfcReal,
and silently truncating 2.7 to 2 would invent precision the file did
not state.
Sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
The numeric value, accepting either integer or real.
IFC files are inconsistent about writing 1 versus 1.0 for the same
attribute, so a consumer that insists on one variant will misread real
files.
Sourcepub fn unwrap_typed(&self) -> &Value
pub fn unwrap_typed(&self) -> &Value
Unwrap a Value::Typed to the value inside, otherwise self.
Callers almost always want the payload; the type name matters only to validation and to writers.
Sourcepub fn for_each_ref(&self, f: &mut impl FnMut(EntityId))
pub fn for_each_ref(&self, f: &mut impl FnMut(EntityId))
Visit every entity reference reachable from this value.
References nest arbitrarily deep inside aggregates, so link rewriting and integrity checks need a recursive walk rather than a shallow scan.