pub struct EntityBuilder<'a> { /* private fields */ }Expand description
A partially-specified entity, checked against the schema on build.
Implementations§
Source§impl<'a> EntityBuilder<'a>
impl<'a> EntityBuilder<'a>
Sourcepub fn new(schema: &'a Schema, entity: impl Into<String>) -> Self
pub fn new(schema: &'a Schema, entity: impl Into<String>) -> Self
Start building entity, whose type must be declared by schema.
The type is not checked here: an unknown type is reported by build,
so that a caller assembling several entities gets every failure at the
same point in its code rather than some at construction and some later.
Sourcepub fn set(self, attribute: impl Into<String>, value: Value) -> Self
pub fn set(self, attribute: impl Into<String>, value: Value) -> Self
Set one attribute by its declared name.
Names are matched case-insensitively, because EXPRESS declares
GlobalId while STEP files and much prose write GLOBALID.
Sourcepub fn text(
self,
attribute: impl Into<String>,
text: impl Into<Arc<str>>,
) -> Self
pub fn text( self, attribute: impl Into<String>, text: impl Into<Arc<str>>, ) -> Self
Set a text attribute.
Sourcepub fn real(self, attribute: impl Into<String>, value: f64) -> Self
pub fn real(self, attribute: impl Into<String>, value: f64) -> Self
Set a real-valued attribute.
Source§impl EntityBuilder<'_>
impl EntityBuilder<'_>
Sourcepub fn build(self) -> AuthorResult<Entity>
pub fn build(self) -> AuthorResult<Entity>
Resolve every named attribute to its STEP slot and produce the entity.
§Errors
Refuses an unknown entity type, an attribute the schema does not declare, an attribute set twice, a required attribute left unset, a scalar/aggregate confusion, a value whose shape contradicts the declared type, and a malformed GlobalId.