diff --git a/node-graph/libraries/core-types/src/context.rs b/node-graph/libraries/core-types/src/context.rs index b122f673d1..d818ba660b 100644 --- a/node-graph/libraries/core-types/src/context.rs +++ b/node-graph/libraries/core-types/src/context.rs @@ -989,6 +989,21 @@ impl<'a> ContextImpl<'a> { ..*self } } + + /// The promote half of decompose-and-promote: derives the context for the + /// content of one copy at a pushed structure level. `copy` becomes the + /// enclosing level's index (held in `frame`, which the caller owns for the + /// derived context's scope) and `inner` is the content's lane within that + /// copy. The structure node computes `copy`/`inner` from its own + /// extent-driven decomposition of the current lane. + pub fn push_level<'s>(&self, frame: &'s mut IndexLink<'s>, copy: u64, inner: u64) -> ContextImpl<'s> + where + 'a: 's, + { + frame.index = copy; + frame.outer = self.index.outer; + self.promoted(frame, inner) + } } impl Ctx for ContextImpl<'_> {} diff --git a/node-graph/libraries/core-types/src/node.rs b/node-graph/libraries/core-types/src/node.rs index 514cccb75b..f49c801652 100644 --- a/node-graph/libraries/core-types/src/node.rs +++ b/node-graph/libraries/core-types/src/node.rs @@ -181,6 +181,20 @@ pub trait Node { GPoll::Final(Extent::Free) } + /// The count of items at one absolute nesting level (innermost `0`). The + /// leveled primitive a structure node overrides to report a pushed level's + /// size; the scalar base is one item at every level. Uncertainty rides the + /// `GPoll` status axis, as with [`extent`](Node::extent). + fn extent_at(&self, _input: &Input, _level: u8) -> GPoll { + GPoll::Final(Extent::Exactly(1)) + } + + /// The node's domain depth (number of nesting levels; `0` = scalar), baked + /// into the record layout at wiring. + fn depth(&self) -> u8 { + self.layout().depth + } + /// Introspection access to node-resident records; `None` for ordinary nodes. fn serialize(&self) -> Option> { None @@ -252,6 +266,10 @@ where (**self).extent(input) } + fn extent_at(&self, input: &Input, level: u8) -> GPoll { + (**self).extent_at(input, level) + } + fn serialize(&self) -> Option> { (**self).serialize() } @@ -282,6 +300,10 @@ where (**self).extent(input) } + fn extent_at(&self, input: &Input, level: u8) -> GPoll { + (**self).extent_at(input, level) + } + fn serialize(&self) -> Option> { (**self).serialize() } @@ -312,6 +334,10 @@ where (**self).extent(input) } + fn extent_at(&self, input: &Input, level: u8) -> GPoll { + (**self).extent_at(input, level) + } + fn serialize(&self) -> Option> { (**self).serialize() }