#[non_exhaustive]pub struct Attribute {
pub name: String,
pub type_name: String,
pub optional: bool,
pub aggregate: bool,
pub aggregation: Vec<Aggregation>,
}Expand description
One explicit positional attribute declared by an entity.
#[non_exhaustive]: build one with Attribute::new and the builder
methods. Further facts about a declaration are added as new fields
without breaking existing readers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringDeclared attribute name.
type_name: StringDeclared scalar type, or the innermost element type of an aggregate:
IfcLengthMeasure for LIST [1:?] OF LIST [3:3] OF IfcLengthMeasure.
optional: boolWhether OPTIONAL was present.
aggregate: boolWhether a LIST, SET, ARRAY, or BAG wrapper was present.
aggregation: Vec<Aggregation>Aggregation levels with their bounds, outermost first; empty for a
scalar. A table written before bounds were recorded (artifact format
1 or 2) has aggregate set and this empty.
Implementations§
Source§impl Attribute
impl Attribute
Sourcepub fn new(name: impl Into<String>, type_name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, type_name: impl Into<String>) -> Self
Creates a required scalar attribute.
Sourcepub const fn aggregate(self) -> Self
pub const fn aggregate(self) -> Self
Marks the attribute as an aggregate without recording its shape.
Prefer Self::with_aggregation, which records kind and bounds.
Sourcepub fn with_aggregation(self, aggregation: Aggregation) -> Self
pub fn with_aggregation(self, aggregation: Aggregation) -> Self
Wraps the type in one more aggregation level, inside any already
added: call it outermost first. Also sets Self::aggregate.