Skip to main content

EntityDef

Struct EntityDef 

Source
pub struct EntityDef {
    pub name: String,
    pub supertype: Option<String>,
    pub abstract_: bool,
    pub attributes: Vec<Attribute>,
    pub derived: Vec<String>,
}
Expand description

One structural entity declaration.

Fields§

§name: String

Declared entity name.

§supertype: Option<String>

First direct supertype, when a SUBTYPE OF clause is present.

§abstract_: bool

Whether the declaration includes ABSTRACT.

§attributes: Vec<Attribute>

Explicit attributes declared by this entity, excluding derived and inverse declarations.

§derived: Vec<String>

Names of attributes this entity declares in its DERIVE block.

A subtype may redeclare an inherited explicit attribute as derived:

DERIVE
  SELF\IfcGeometricRepresentationContext.Precision : IfcReal
      := NVL(ParentContext.Precision, 1.E-5);

The redeclaration keeps the attribute’s inherited position but removes it from what an instance may state: Part 21 writes such a slot as *, not as a value and not as $. A consumer that does not know an attribute is derived cannot tell those apart, so this list is the minimum needed to write a conforming file.

Names are stored unqualified — the SELF\Entity. prefix is stripped — because that is how they match the inherited attribute they redeclare. Entries are in declaration order. Derived attributes that are new rather than redeclarations appear here too; they occupy no positional slot, so consumers resolving slots should match against inherited attribute names rather than assuming every entry is positional.

Implementations§

Source§

impl EntityDef

Source

pub fn new(name: impl Into<String>) -> Self

Creates an empty concrete entity declaration.

Source

pub fn with_supertype(self, supertype: impl Into<String>) -> Self

Sets the direct supertype.

Source

pub fn with_attribute(self, attribute: Attribute) -> Self

Appends an explicit attribute in declaration order.

Source

pub fn with_derived(self, name: impl Into<String>) -> Self

Declares an attribute name as derived, as a DERIVE block would.

Source

pub fn is_derived(&self, name: &str) -> bool

Whether name is declared derived by this entity.

Comparison is ASCII case-insensitive: EXPRESS identifiers are case-sensitive in principle, but schema text and Part 21 keywords disagree on case often enough that matching exactly is a foot-gun.

Trait Implementations§

Source§

impl Clone for EntityDef

Source§

fn clone(&self) -> EntityDef

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 EntityDef

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for EntityDef

Source§

impl PartialEq for EntityDef

Source§

fn eq(&self, other: &EntityDef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EntityDef

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
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.

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

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.