Skip to main content

ResourceView

Struct ResourceView 

Source
pub struct ResourceView<'m, 's> { /* private fields */ }
Expand description

Borrowed, schema-resolved entry point for the bounded resource slice (IFC2X3 TC1, IFC4 ADD2 TC1, IFC4X3 ADD2): pairs a model with the schema selected for it and exposes per-entity projection and query methods.

Implementations§

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn allocation(&self, id: EntityId) -> ResourceResult<ResourceAllocation>

Projects an IfcRelAssignsToResource relation by entity id.

Source

pub fn allocations_for( &self, resource: EntityId, ) -> ResourceResult<Vec<ResourceAllocation>>

Every IfcRelAssignsToResource relation naming this resource as RelatingResource, in ancestor order.

Under IFC2X3 an IfcConstructionMaterialResource or IfcConstructionProductResource also carries the release’s WR1 (at most one such relation) and WR2 (its RelatedObjectsType, when authored, is PRODUCT); a violation is a typed refusal.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn parent_resource( &self, child: EntityId, ) -> ResourceResult<Option<EntityId>>

Return the authored construction-resource parent, if any.

Source

pub fn direct_members(&self, parent: EntityId) -> ResourceResult<Vec<EntityId>>

Return direct authored members in relation/LIST order.

Source

pub fn descendants( &self, root: EntityId, budget: Budget, ) -> ResourceResult<Vec<EntityId>>

Return depth-first authored descendants within explicit limits.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn resource_type( &self, id: EntityId, ) -> ResourceResult<ConstructionResourceType<'m, 's>>

Projects a resource-type catalog entry by entity id.

Source

pub fn assigned_resource_type( &self, occurrence: EntityId, ) -> ResourceResult<Option<EntityId>>

Resolves the IfcConstructionResourceType assigned to a construction resource occurrence through IfcRelDefinesByType, if any.

An occurrence may be typed by at most one type. A second authored relation assigning a different type is a modeling defect, reported as a typed refusal rather than silently picking the first or last match. A repeated relation naming the same type states the same fact twice and is accepted. (ifc-material treats even that as ambiguous for its material lookup.)

IFC2X3 declares no IfcConstructionResourceType, so this refuses with ResourceError::NotInSchema there instead of answering None.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn simple_quantity( &self, id: EntityId, ) -> ResourceResult<SimpleQuantity<'m, 's>>

Projects an IfcPhysicalSimpleQuantity by entity id.

Source

pub fn measure_with_unit( &self, id: EntityId, ) -> ResourceResult<MeasureWithUnit<'m, 's>>

Projects an IfcMeasureWithUnit by entity id: the IFC2X3 BaseQuantity form (see ConstructionResource::base_quantity_measure).

Source

pub fn complex_quantity( &self, id: EntityId, ) -> ResourceResult<ComplexQuantity<'m, 's>>

Projects an IfcPhysicalComplexQuantity by entity id.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn new(model: &'m Model, schema: &'s Schema) -> ResourceResult<Self>

Builds a view over model using an explicit schema, failing if schema is not IFC2X3, IFC4 or IFC4X3, or does not match the model’s declared FILE_SCHEMA token.

Source

pub fn schema(&self) -> &'s Schema

The bundled schema this view resolves attributes against.

Source

pub fn resource( &self, id: EntityId, ) -> ResourceResult<ConstructionResource<'m, 's>>

Projects a concrete IfcConstructionResource occurrence by entity id.

Source

pub fn resource_time( &self, id: EntityId, ) -> ResourceResult<ResourceTime<'m, 's>>

Projects an IfcResourceTime by entity id.

Source§

impl<'m> ResourceView<'m, 'static>

Source

pub fn for_model(model: &'m Model) -> ResourceResult<Self>

Selects the bundled schema matching the model’s declared FILE_SCHEMA token (IFC2X3 TC1, IFC4 ADD2 TC1 or IFC4X3 ADD2), failing if the header names no schema, more than one, or an unsupported one.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn organization_relationship( &self, id: EntityId, ) -> ResourceResult<OrganizationRelationship<'m, 's>>

Projects an IfcOrganizationRelationship by entity id.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn person(&self, id: EntityId) -> ResourceResult<Person<'m, 's>>

Projects an IfcPerson by entity id.

Source

pub fn organization(&self, id: EntityId) -> ResourceResult<Organization<'m, 's>>

Projects an IfcOrganization by entity id.

Source

pub fn actor_role(&self, id: EntityId) -> ResourceResult<ActorRole<'m, 's>>

Projects an IfcActorRole by entity id.

Source

pub fn person_and_organization( &self, id: EntityId, ) -> ResourceResult<PersonAndOrganization<'m, 's>>

Projects an IfcPersonAndOrganization by entity id.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn inventory_items( &self, inventory: EntityId, ) -> ResourceResult<Vec<EntityId>>

Members of an IfcInventory group, authored order, via IfcRelAssignsToGroup.RelatingGroup.

IfcGroup.IsGroupedBy is SET [0:?]: an inventory may be named by several assignment relations. Members from every authored relation are concatenated in relation-then-list order; duplicates across relations are preserved verbatim rather than deduplicated, since the schema does not require assignment relations to be disjoint.

Source§

impl<'m, 's> ResourceView<'m, 's>

Source

pub fn inventory(&self, id: EntityId) -> ResourceResult<Inventory<'m, 's>>

Projects an IfcInventory by entity id.

Trait Implementations§

Source§

impl<'m, 's> Clone for ResourceView<'m, 's>

Source§

fn clone(&self) -> ResourceView<'m, 's>

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, 's> Copy for ResourceView<'m, 's>

Source§

impl<'m, 's> Debug for ResourceView<'m, 's>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'m, 's> !RefUnwindSafe for ResourceView<'m, 's>

§

impl<'m, 's> !UnwindSafe for ResourceView<'m, 's>

§

impl<'m, 's> Freeze for ResourceView<'m, 's>

§

impl<'m, 's> Send for ResourceView<'m, 's>

§

impl<'m, 's> Sync for ResourceView<'m, 's>

§

impl<'m, 's> Unpin for ResourceView<'m, 's>

§

impl<'m, 's> UnsafeUnpin for ResourceView<'m, 's>

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
§

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

§

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.

§

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.