Skip to main content

Slots

Struct Slots 

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

Attribute reader bound to one entity.

Carries the id and type name so every error is self-locating without the call site repeating them.

Implementations§

Source§

impl<'m> Slots<'m>

Source

pub fn new(id: EntityId, entity: &'m Entity) -> Self

Wrap an entity for attribute access.

Source

pub fn id(&self) -> EntityId

The entity id.

Source

pub fn entity(&self) -> &'m Entity

The underlying entity.

Source

pub fn type_name(&self) -> &'m str

The IFC type name.

Source

pub fn opt(&self, index: usize) -> Option<&'m Value>

Raw attribute, None when absent or $.

Treats a missing slot and an explicit $ alike: both mean “not provided”, and real files disagree about which to write for trailing optionals.

Source

pub fn req(&self, index: usize, name: &'static str) -> GeometryResult<&'m Value>

Required attribute.

Source

pub fn req_f64(&self, index: usize, name: &'static str) -> GeometryResult<f64>

Required real number, accepting an integer literal.

STEP writes 0 where a real is declared often enough that rejecting it would fail on conforming-in-practice files.

Source

pub fn opt_f64(&self, index: usize) -> Option<f64>

Optional real number.

Source

pub fn req_i64(&self, index: usize, name: &'static str) -> GeometryResult<i64>

Required integer.

Source

pub fn req_ref( &self, index: usize, name: &'static str, ) -> GeometryResult<EntityId>

Required entity reference.

Source

pub fn opt_ref(&self, index: usize) -> Option<EntityId>

Optional entity reference.

Source

pub fn req_f64_list( &self, index: usize, name: &'static str, ) -> GeometryResult<Vec<f64>>

Required list of reals, e.g. Coordinates on IfcCartesianPoint.

Source

pub fn req_ref_list( &self, index: usize, name: &'static str, ) -> GeometryResult<Vec<EntityId>>

Required list of entity references.

Source

pub fn opt_ref_list(&self, index: usize) -> Vec<EntityId>

Optional list of entity references; absent becomes empty.

Source

pub fn opt_text(&self, index: usize) -> Option<String>

Enumeration token without its dots, e.g. .CARTESIAN. -> CARTESIAN. A text attribute, absent when unset or not a string.

Labels like RepresentationIdentifier are optional in the schema and authors do omit them, so a missing value is data rather than an error.

Source

pub fn opt_enum(&self, index: usize) -> Option<&'m str>

The enumeration token at index, when the slot holds one.

Returns None for an omitted slot and for a value that is present but not an enumeration, so a caller cannot mistake a type error for an authored absence.

Source

pub fn opt_bool(&self, index: usize) -> Option<bool>

Boolean or logical value.

Returns None for .U. (logical unknown), which is a real third state in IFC and must not silently become false.

Source

pub fn req_bool(&self, index: usize, name: &'static str) -> GeometryResult<bool>

Required boolean.

Source

pub fn resolve( &self, model: &'m Model, id: EntityId, ) -> GeometryResult<&'m Entity>

Resolve a referenced entity, failing if it dangles.

Source

pub fn unsupported(&self, detail: &'static str) -> GeometryError

Report a valid-but-unhandled entity.

Source

pub fn degenerate(&self, detail: impl Into<String>) -> GeometryError

Report geometry that cannot exist.

Trait Implementations§

Source§

impl<'m> Clone for Slots<'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 Slots<'m>

Source§

impl<'m> Debug for Slots<'m>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'m> Freeze for Slots<'m>

§

impl<'m> RefUnwindSafe for Slots<'m>

§

impl<'m> Send for Slots<'m>

§

impl<'m> Sync for Slots<'m>

§

impl<'m> Unpin for Slots<'m>

§

impl<'m> UnsafeUnpin for Slots<'m>

§

impl<'m> UnwindSafe for Slots<'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.