Skip to main content

MaterialView

Struct MaterialView 

Source
pub struct MaterialView<'m> { /* private fields */ }
Expand description

Borrowed MaterialResource interpretation of a model.

Every projection the view hands out reads against the release the model’s header declares (see crate::material_schema): slot positions come from that release’s bundled table, never from IFC4 by assumption.

Implementations§

Source§

impl<'m> MaterialView<'m>

Source

pub fn constituents(self) -> impl Iterator<Item = MaterialConstituent<'m>> + 'm

Iterates every IfcMaterialConstituent instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn constituent_sets( self, ) -> impl Iterator<Item = MaterialConstituentSet<'m>> + 'm

Iterates every IfcMaterialConstituentSet instance in the model.

IFC2X3 declares no constituent set: a record of this type in an IFC2X3 model is still yielded, and every accessor on it fails with MaterialError::EntityNotInSchema rather than being skipped.

Source§

impl<'m> MaterialView<'m>

Source

pub fn constituent_fraction_diagnostic( self, set: MaterialConstituentSet<'m>, tolerance: f64, ) -> MaterialResult<Option<ConstituentFractionDiagnostic>>

Opt-in policy check that a constituent set’s fractions make one whole.

Returns Ok(None) when every constituent states a fraction and the sum is within tolerance of 1, when no constituent states one, and when the set lists no constituents. A sum outside the tolerance is ConstituentFractionDiagnostic::SumNotOne; a mix of stated and missing fractions is ConstituentFractionDiagnostic::PartiallyStated. The file is never corrected: fractions are reported as authored.

A negative or NaN tolerance admits no sum, so every fully stated set is reported.

§Errors

The decode errors of the underlying accessors: a malformed member list, a member id absent from the model or not an IfcMaterialConstituent, or a fraction outside 0..=1. The diagnostic itself is never an error.

Source§

impl<'m> MaterialView<'m>

Source

pub fn layers(self) -> impl Iterator<Item = MaterialLayer<'m>> + 'm

Iterates every IfcMaterialLayer instance in the model.

Source

pub fn layers_with_offsets( self, ) -> impl Iterator<Item = MaterialLayerWithOffsets<'m>> + 'm

Iterates every IfcMaterialLayerWithOffsets instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn layer_sets(self) -> impl Iterator<Item = MaterialLayerSet<'m>> + 'm

Iterates every IfcMaterialLayerSet instance in the model.

Source

pub fn total_thickness(self, set: MaterialLayerSet<'m>) -> MaterialResult<f64>

Evaluate the normative IfcMlsTotalThickness function.

Each member is read against the set’s release: an IfcMaterialLayerWithOffsets member of an IFC2X3 set is EntityNotInSchema, and a zero IFC2X3 thickness is invalid.

Source§

impl<'m> MaterialView<'m>

Source

pub fn layer_set_usages( self, ) -> impl Iterator<Item = MaterialLayerSetUsage<'m>> + 'm

Iterates every IfcMaterialLayerSetUsage instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn materials(self) -> impl Iterator<Item = Material<'m>> + 'm

Iterates every IfcMaterial instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn material_properties( self, ) -> impl Iterator<Item = MaterialProperties<'m>> + 'm

Iterates every IfcMaterialProperties instance in the model.

Source

pub fn properties_for( self, material: EntityId, ) -> impl Iterator<Item = MaterialResult<MaterialProperties<'m>>> + 'm

Iterates every IfcMaterialProperties whose Material attribute resolves to material, surfacing malformed records as errors rather than skipping them.

Source§

impl<'m> MaterialView<'m>

Source

pub fn classification_relationships( self, ) -> impl Iterator<Item = MaterialClassificationRelationship<'m>> + 'm

Iterates every IfcMaterialClassificationRelationship in the model.

Source

pub fn material_lists(self) -> impl Iterator<Item = MaterialList<'m>> + 'm

Iterates every IfcMaterialList instance in the model.

Source

pub fn material_relationships( self, ) -> impl Iterator<Item = MaterialRelationship<'m>> + 'm

Iterates every IfcMaterialRelationship instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn profiles(self) -> impl Iterator<Item = MaterialProfile<'m>> + 'm

Iterates every IfcMaterialProfile instance in the model.

Source

pub fn profiles_with_offsets( self, ) -> impl Iterator<Item = MaterialProfileWithOffsets<'m>> + 'm

Iterates every IfcMaterialProfileWithOffsets instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn profile_sets(self) -> impl Iterator<Item = MaterialProfileSet<'m>> + 'm

Iterates every IfcMaterialProfileSet instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn profile_set_usages( self, ) -> impl Iterator<Item = MaterialProfileSetUsage<'m>> + 'm

Iterates every IfcMaterialProfileSetUsage instance in the model.

Source

pub fn tapering_profile_set_usages( self, ) -> impl Iterator<Item = MaterialProfileSetUsageTapering<'m>> + 'm

Iterates every IfcMaterialProfileSetUsageTapering instance in the model.

Source§

impl<'m> MaterialView<'m>

Source

pub fn assignments(self) -> impl Iterator<Item = MaterialAssignment<'m>> + 'm

Iterates every IfcRelAssociatesMaterial instance in the model.

Source

pub fn assignments_for( self, object: EntityId, ) -> MaterialResult<Vec<MaterialAssignment<'m>>>

Collects every IfcRelAssociatesMaterial whose RelatedObjects includes object. Multiple hits indicate an ambiguous direct assignment; callers that need a single answer should check the result length themselves or use assigned_material.

Source§

impl<'m> MaterialView<'m>

Source

pub fn material_definitions( self, ) -> impl Iterator<Item = MaterialDefinition<'m>> + 'm

Every concrete subtype of the abstract IfcMaterialDefinition.

Yields by type name; a record the model’s release does not declare (an IFC2X3 constituent set, say) is still yielded, and its accessors fail with MaterialError::EntityNotInSchema.

Source

pub fn material_usage_definitions( self, ) -> impl Iterator<Item = MaterialUsageDefinition<'m>> + 'm

Every concrete subtype of the abstract IfcMaterialUsageDefinition.

Yields by type name, as Self::material_definitions does.

Source

pub fn resolve_material_select( self, id: EntityId, ) -> MaterialResult<ResolvedMaterialSelect<'m>>

Resolves id as an IfcMaterialSelect branch of the model’s release by dispatching on its concrete IFC entity type.

§Errors

MaterialError::WrongEntityType if id names an entity that is no MaterialResource select member; MaterialError::EntityNotInSchema if it is a member of another release only, such as an IfcMaterialConstituentSet or IfcMaterialProfileSet in an IFC2X3 model; and the release-binding errors when the header binds no release.

Source

pub fn assigned_material( self, object: EntityId, ) -> MaterialResult<Option<ResolvedAssignment<'m>>>

Resolves the single material that applies to object, preferring a direct IfcRelAssociatesMaterial on the object itself and falling back to the material assigned to its IfcTypeObject via IfcRelDefinesByType. Returns Ok(None) if neither exists. Fails with crate::MaterialError::AmbiguousAssignment or crate::MaterialError::AmbiguousType if more than one candidate is found at either level, and with crate::MaterialError::UnknownEntity if object is not in the model.

Every record is read against the model’s release, so an IFC2X3 model resolves with IFC2X3 slots and type objects.

The type fallback is exactly one IfcRelDefinesByType hop, and two such relations are ambiguous even when they name the same type: the file states the typing twice, and this lookup does not guess which statement was meant. (ifc-resource deliberately accepts a repeated relation naming the same type.)

Source§

impl<'m> MaterialView<'m>

Source

pub fn new(model: &'m Model) -> Self

Wraps a model reference for MaterialResource projection, bound to the release its header declares.

Source

pub fn model(self) -> &'m Model

Returns the underlying model this view borrows from.

Source

pub fn schema(self) -> MaterialResult<SchemaVersion>

The release this view’s projections read against.

§Errors

MaterialError::MultipleSchemas or MaterialError::UnsupportedSchema when the header binds none.

Trait Implementations§

Source§

impl<'m> Clone for MaterialView<'m>

Source§

fn clone(&self) -> Self

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<'m> Copy for MaterialView<'m>

Source§

impl<'m> Debug for MaterialView<'m>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'m> !RefUnwindSafe for MaterialView<'m>

§

impl<'m> !UnwindSafe for MaterialView<'m>

§

impl<'m> Freeze for MaterialView<'m>

§

impl<'m> Send for MaterialView<'m>

§

impl<'m> Sync for MaterialView<'m>

§

impl<'m> Unpin for MaterialView<'m>

§

impl<'m> UnsafeUnpin for MaterialView<'m>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

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.