pub struct Slots<'m> { /* private fields */ }Expand description
Attribute reader bound to one entity.
Carries the id and type name so every error is self-locating without the call site repeating them.
Implementations§
Source§impl<'m> Slots<'m>
impl<'m> Slots<'m>
Sourcepub fn opt(&self, index: usize) -> Option<&'m Value>
pub fn opt(&self, index: usize) -> Option<&'m Value>
Raw attribute, None when absent or $.
Treats a missing slot and an explicit $ alike: both mean “not
provided”, and real files disagree about which to write for trailing
optionals.
Sourcepub fn req(&self, index: usize, name: &'static str) -> GeometryResult<&'m Value>
pub fn req(&self, index: usize, name: &'static str) -> GeometryResult<&'m Value>
Required attribute.
Sourcepub fn req_f64(&self, index: usize, name: &'static str) -> GeometryResult<f64>
pub fn req_f64(&self, index: usize, name: &'static str) -> GeometryResult<f64>
Required real number, accepting an integer literal.
STEP writes 0 where a real is declared often enough that rejecting it
would fail on conforming-in-practice files.
Sourcepub fn req_i64(&self, index: usize, name: &'static str) -> GeometryResult<i64>
pub fn req_i64(&self, index: usize, name: &'static str) -> GeometryResult<i64>
Required integer.
Sourcepub fn req_ref(
&self,
index: usize,
name: &'static str,
) -> GeometryResult<EntityId>
pub fn req_ref( &self, index: usize, name: &'static str, ) -> GeometryResult<EntityId>
Required entity reference.
Sourcepub fn req_f64_list(
&self,
index: usize,
name: &'static str,
) -> GeometryResult<Vec<f64>>
pub fn req_f64_list( &self, index: usize, name: &'static str, ) -> GeometryResult<Vec<f64>>
Required list of reals, e.g. Coordinates on IfcCartesianPoint.
Sourcepub fn req_ref_list(
&self,
index: usize,
name: &'static str,
) -> GeometryResult<Vec<EntityId>>
pub fn req_ref_list( &self, index: usize, name: &'static str, ) -> GeometryResult<Vec<EntityId>>
Required list of entity references.
Sourcepub fn opt_ref_list(&self, index: usize) -> Vec<EntityId>
pub fn opt_ref_list(&self, index: usize) -> Vec<EntityId>
Optional list of entity references; absent becomes empty.
Sourcepub fn opt_text(&self, index: usize) -> Option<String>
pub fn opt_text(&self, index: usize) -> Option<String>
Enumeration token without its dots, e.g. .CARTESIAN. -> CARTESIAN.
A text attribute, absent when unset or not a string.
Labels like RepresentationIdentifier are optional in the schema and authors do omit them, so a missing value is data rather than an error.
Sourcepub fn opt_enum(&self, index: usize) -> Option<&'m str>
pub fn opt_enum(&self, index: usize) -> Option<&'m str>
The enumeration token at index, when the slot holds one.
Returns None for an omitted slot and for a value that is present but
not an enumeration, so a caller cannot mistake a type error for an
authored absence.
Sourcepub fn opt_bool(&self, index: usize) -> Option<bool>
pub fn opt_bool(&self, index: usize) -> Option<bool>
Boolean or logical value.
Returns None for .U. (logical unknown), which is a real third state
in IFC and must not silently become false.
Sourcepub fn req_bool(&self, index: usize, name: &'static str) -> GeometryResult<bool>
pub fn req_bool(&self, index: usize, name: &'static str) -> GeometryResult<bool>
Required boolean.
Sourcepub fn resolve(
&self,
model: &'m Model,
id: EntityId,
) -> GeometryResult<&'m Entity>
pub fn resolve( &self, model: &'m Model, id: EntityId, ) -> GeometryResult<&'m Entity>
Resolve a referenced entity, failing if it dangles.
Sourcepub fn unsupported(&self, detail: &'static str) -> GeometryError
pub fn unsupported(&self, detail: &'static str) -> GeometryError
Report a valid-but-unhandled entity.
Sourcepub fn degenerate(&self, detail: impl Into<String>) -> GeometryError
pub fn degenerate(&self, detail: impl Into<String>) -> GeometryError
Report geometry that cannot exist.