pub struct Node { /* private fields */ }Expand description
A node in the immutable operation graph.
Nodes are never mutated after construction. Build them through Image
rather than directly.
Implementations§
Source§impl Node
impl Node
Sourcepub const fn descriptor(&self) -> ImageDescriptor
pub const fn descriptor(&self) -> ImageDescriptor
The shape of this node’s output, resolved at build time.
Sourcepub fn producer(&self) -> Option<&Arc<dyn Producer>>
pub fn producer(&self) -> Option<&Arc<dyn Producer>>
The producer at this node, or None if it is an interior op.
Sourcepub fn node_count(self: &Arc<Self>) -> usize
pub fn node_count(self: &Arc<Self>) -> usize
The number of nodes reachable from here, counting shared nodes once.
Useful for asserting in tests that chaining built the graph it should have, and that a shared prefix really is shared.
Trait Implementations§
Source§impl Drop for Node
impl Drop for Node
Source§fn drop(&mut self)
fn drop(&mut self)
Tear the graph down iteratively.
The derived drop glue would recurse once per node: a node drops its
inputs, each of which drops its inputs, and so on. A long chain —
which callers build simply by chaining many ops — would then overflow
the stack at teardown, aborting the process. Since an abort is exactly
what the failure model forbids, teardown uses an explicit worklist.
Only uniquely-owned inputs are unwrapped: a node still shared by another branch of the DAG is left for its last owner to drop.