#[non_exhaustive]pub struct EntityDef {
pub name: String,
pub supertypes: Vec<String>,
pub abstract_: bool,
pub attributes: Vec<Attribute>,
pub derived: Vec<String>,
pub where_rules: Vec<WhereRule>,
pub inverses: Vec<InverseAttribute>,
pub unique_rules: Vec<UniqueRule>,
}Expand description
One structural entity declaration.
#[non_exhaustive]: build one with EntityDef::new and the builder
methods. Declaration facts not yet recorded are added as new fields
without breaking 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 entity name.
supertypes: Vec<String>Direct supertypes in SUBTYPE OF order; empty for a root entity.
IFC is single-inheritance, so this holds at most one name for every
bundled schema; Self::supertype reads it.
abstract_: boolWhether the declaration includes ABSTRACT.
attributes: Vec<Attribute>Explicit attributes declared by this entity, excluding derived and inverse declarations and explicit redeclarations of inherited ones.
derived: Vec<String>Names of attributes this entity declares in its DERIVE block,
unqualified (SELF\Entity. stripped), in declaration order.
A redeclared inherited attribute keeps its position but is written
* in a Part 21 record. New derived attributes appear here too; they
occupy no positional slot.
where_rules: Vec<WhereRule>WHERE rules declared by this entity (not inherited ones), in
declaration order.
inverses: Vec<InverseAttribute>INVERSE attributes declared by this entity, in declaration order.
Empty in a table written before they were recorded (artifact format
1 or 2).
unique_rules: Vec<UniqueRule>UNIQUE rules declared by this entity (not inherited ones), in
declaration order. Empty in a table written before they were
recorded (artifact format 1 or 2).
Implementations§
Source§impl EntityDef
impl EntityDef
Sourcepub fn with_inverse(self, inverse: InverseAttribute) -> Self
pub fn with_inverse(self, inverse: InverseAttribute) -> Self
Appends an INVERSE attribute in declaration order.
Sourcepub fn with_unique_rule(self, rule: UniqueRule) -> Self
pub fn with_unique_rule(self, rule: UniqueRule) -> Self
Appends a UNIQUE rule in declaration order.
Sourcepub fn with_supertype(self, supertype: impl Into<String>) -> Self
pub fn with_supertype(self, supertype: impl Into<String>) -> Self
Appends a direct supertype, after any already declared.
Sourcepub const fn abstract_entity(self) -> Self
pub const fn abstract_entity(self) -> Self
Marks the declaration ABSTRACT.
Sourcepub fn with_attribute(self, attribute: Attribute) -> Self
pub fn with_attribute(self, attribute: Attribute) -> Self
Appends an explicit attribute in declaration order.
Sourcepub fn with_derived(self, name: impl Into<String>) -> Self
pub fn with_derived(self, name: impl Into<String>) -> Self
Declares an attribute name as derived, as a DERIVE block would.
Sourcepub fn with_where_rule(self, rule: WhereRule) -> Self
pub fn with_where_rule(self, rule: WhereRule) -> Self
Appends a WHERE rule in declaration order.
Sourcepub fn is_derived(&self, name: &str) -> bool
pub fn is_derived(&self, name: &str) -> bool
Whether name is declared derived by this entity.
Comparison is ASCII case-insensitive.