ifc-classification 0.2.2

Classification systems, document references, libraries, external references.
Documentation
//! Borrowed `IfcLibraryInformation` projection.
use crate::view::{
    borrowed_entity, optional_ref, optional_text, required_text, ClassificationView,
};
use crate::ClassificationResult;
borrowed_entity!(LibraryInformation, "IFCLIBRARYINFORMATION");
impl<'m> LibraryInformation<'m> {
    /// The required `Name` of the library.
    pub fn name(self) -> ClassificationResult<&'m str> {
        required_text(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.text_slot("Name")?,
            "Name",
        )
    }
    /// The `Version` label of the library, when authored.
    pub fn version(self) -> ClassificationResult<Option<&'m str>> {
        optional_text(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.text_slot("Version")?,
            "Version",
        )
    }
    /// Id of the `Publisher` (an `IfcActorSelect`), when authored.
    pub fn publisher_id(self) -> ClassificationResult<Option<ifc_model::EntityId>> {
        optional_ref(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.slot("Publisher")?,
            "Publisher",
        )
    }
    /// The `VersionDate` of the library, when authored.
    pub fn version_date(self) -> ClassificationResult<Option<&'m str>> {
        optional_text(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.text_slot("VersionDate")?,
            "VersionDate",
        )
    }
    /// The `Location` (e.g. a URI) of the library, when authored.
    pub fn location(self) -> ClassificationResult<Option<&'m str>> {
        optional_text(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.text_slot("Location")?,
            "Location",
        )
    }
    /// The `Description` of the library, when authored.
    pub fn description(self) -> ClassificationResult<Option<&'m str>> {
        optional_text(
            "IFCLIBRARYINFORMATION",
            self.id(),
            self.entity(),
            self.text_slot("Description")?,
            "Description",
        )
    }
}
impl<'m> ClassificationView<'m> {
    /// All `IfcLibraryInformation` instances in the model.
    pub fn libraries(self) -> impl Iterator<Item = LibraryInformation<'m>> + 'm {
        self.model()
            .of_type("IFCLIBRARYINFORMATION")
            .map(move |(id, e)| LibraryInformation::from_known(id, e, self.release()))
    }
}