Skip to main content

LoweringSession

Struct LoweringSession 

Source
pub struct LoweringSession<'a> { /* private fields */ }
Expand description

A single recursive lowering pass over one shared graph builder.

Family lowerers take &mut LoweringSession and return NodeId. Only the public entry point calls LoweringSession::finish.

Implementations§

Source§

impl<'a> LoweringSession<'a>

Source

pub fn new(model: &'a Model, units: &'a UnitScale) -> Self

Open a session with the default recursion budget.

Source

pub fn with_limits( model: &'a Model, units: &'a UnitScale, limits: SessionLimits, ) -> Self

Open a session with an explicit recursion budget.

Source

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

The model being lowered.

Source

pub fn units(&self) -> &'a UnitScale

The resolved unit scale for this model.

Source

pub fn node_count(&self) -> usize

Number of nodes appended so far.

Exposed so tests can assert that a memoized hit appends nothing.

Source

pub fn node(&mut self, node: GeometryNode) -> GeometryResult<NodeId>

Append one node, attributing any graph fault to the current entity.

Source

pub fn node_for( &mut self, entity: EntityId, node: GeometryNode, ) -> GeometryResult<NodeId>

Append one node, attributing any graph fault to entity.

Source

pub fn provenance(&self) -> &ProvenanceMap

Source attribution accumulated so far.

Source

pub fn entity( &self, referrer: EntityId, id: EntityId, ) -> GeometryResult<&'a Entity>

Resolve an entity or report the dangling reference against referrer.

Source

pub fn memoized( &self, entity: EntityId, family: &'static str, frame: Transform, ) -> Option<NodeId>

Look up a previously lowered result for entity under frame.

Source

pub fn memoize( &mut self, entity: EntityId, family: &'static str, frame: Transform, node: NodeId, )

Record the lowered result for entity under frame.

Source

pub fn enter( &mut self, entity: EntityId, kind: &'static str, ) -> GeometryResult<()>

Mark entity as active in the current chain.

Returns GeometryError::CyclicChain if the entity is already active and GeometryError::ChainTooDeep once the depth budget is exhausted. Every successful call must be paired with LoweringSession::exit.

Source

pub fn exit(&mut self, entity: EntityId)

Release entity from the active chain.

Sharing is not recursion: once a subtree is complete the entity must be reachable again from a sibling branch.

Source

pub fn slots(&self, entity: EntityId) -> GeometryResult<Slots<'a>>

Borrowed attribute view for entity.

Source

pub fn type_name(&self, entity: EntityId) -> GeometryResult<String>

Upper-cased IFC type name for entity.

Dispatch compares against canonical upper-case names because STEP files are case-insensitive in practice and exporters disagree.

Source

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

Build a typed Unsupported error naming the offending entity.

Source

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

Build a typed Degenerate error naming the offending entity.

Structurally impossible geometry is distinct from an unimplemented family: the file is understood and the shape does not exist.

Source

pub fn check_aggregate( &self, entity: EntityId, type_name: &str, what: &'static str, requested: u128, ) -> GeometryResult<usize>

Check a file-declared aggregate size against the element budget.

Takes u128 so an overflowing product (triangles * 3) can be computed in a wider type and reported honestly instead of wrapping to a small number that passes the check. Returns the size as usize only once it is known to fit.

Call this before reserving, not after: the point is to refuse the declaration, not to survive the allocation.

Source

pub fn lower_operand( &mut self, entity: EntityId, frame: Transform, ) -> GeometryResult<NodeId>

Lower a nested operand through the total dispatcher.

Kept on the session so recursive families do not each re-import the dispatcher and risk diverging on cycle/limit handling.

Source

pub fn finish(self, root: NodeId) -> GeometryResult<LoweredGeometry>

Freeze the graph with root as its single output root.

Trait Implementations§

Source§

impl<'a> Debug for LoweringSession<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for LoweringSession<'a>

§

impl<'a> RefUnwindSafe for LoweringSession<'a>

§

impl<'a> Send for LoweringSession<'a>

§

impl<'a> Sync for LoweringSession<'a>

§

impl<'a> Unpin for LoweringSession<'a>

§

impl<'a> UnsafeUnpin for LoweringSession<'a>

§

impl<'a> UnwindSafe for LoweringSession<'a>

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