ifc_material/material/
definition.rs1use crate::view::{borrowed_entity, optional_text, required_text, MaterialView};
4use crate::MaterialResult;
5
6borrowed_entity!(Material, "IFCMATERIAL");
7
8impl<'m> Material<'m> {
9 pub fn name(self) -> MaterialResult<&'m str> {
12 required_text(
13 "IFCMATERIAL",
14 self.id(),
15 self.entity(),
16 self.slot("Name")?,
17 "Name",
18 )
19 }
20
21 pub fn description(self) -> MaterialResult<Option<&'m str>> {
28 optional_text(
29 "IFCMATERIAL",
30 self.id(),
31 self.entity(),
32 self.slot("Description")?,
33 "Description",
34 )
35 }
36
37 pub fn category(self) -> MaterialResult<Option<&'m str>> {
44 optional_text(
45 "IFCMATERIAL",
46 self.id(),
47 self.entity(),
48 self.slot("Category")?,
49 "Category",
50 )
51 }
52}
53
54impl<'m> MaterialView<'m> {
55 pub fn materials(self) -> impl Iterator<Item = Material<'m>> + 'm {
57 let release = self.release();
58 self.model()
59 .of_type("IFCMATERIAL")
60 .map(move |(id, entity)| Material::from_known(id, entity, release))
61 }
62}