pub struct Graph<const N: usize, T: Topology<N> = Ordered<N, { shape::ALL }>> {
pub nodes: &'static [Option<&'static TaskNode>; N],
pub topo: T,
pub pools: &'static [&'static dyn Pool],
pub graph_ref: &'static GraphRef,
}Expand description
A static task graph: the nodes, the topology over them, and optional pools.
Fields§
§nodes: &'static [Option<&'static TaskNode>; N]The fixed array of node slots; None marks a disabled or cfg-gapped slot.
topo: TThe topology that defines spawn order and dependency rows.
pools: &'static [&'static dyn Pool]The elastic pools declared in the graph.
graph_ref: &'static GraphRefA reference used to enumerate the graph at runtime.
Implementations§
Source§impl<const N: usize, T: Topology<N>> Graph<N, T>
impl<const N: usize, T: Topology<N>> Graph<N, T>
Sourcepub fn order(
&self,
) -> impl DoubleEndedIterator<Item = u8> + ExactSizeIterator + '_
pub fn order( &self, ) -> impl DoubleEndedIterator<Item = u8> + ExactSizeIterator + '_
The slot indices in topological order (dependencies before their
dependents; .rev() is the teardown order). Declaration order on a
Flat topology.
Sourcepub fn dependents_of(&self, i: u8, visit: &mut dyn FnMut(u8))
pub fn dependents_of(&self, i: u8, visit: &mut dyn FnMut(u8))
Call visit with the slot index of every node that declares slot i as
a dependency (direct dependents only). Computed by a forward scan of
the dep rows — no reverse-edge table is stored, so this is
O(N·E) and meant for control paths and status endpoints, not hot loops.
&mut dyn FnMut rather than a generic: one instantiation, no
monomorphization per call site.
Sourcepub fn iter_nodes(&self) -> impl Iterator<Item = (u8, &'static TaskNode)> + '_
pub fn iter_nodes(&self) -> impl Iterator<Item = (u8, &'static TaskNode)> + '_
Iterate the live nodes with their slot indices, skipping #[cfg]-ed-out
slots — the ergonomic form of GRAPH.nodes.iter().enumerate() for a
status endpoint that needs the index (to reach deps) alongside the node.
Sourcepub fn writers_of(
&self,
signal: &Coupling,
visit: &mut dyn FnMut(u8, &'static TaskNode),
)
pub fn writers_of( &self, signal: &Coupling, visit: &mut dyn FnMut(u8, &'static TaskNode), )
Every node declaring signal in its writes:, by slot and node.
Matched by address, so it is the static that is compared, not the
path text.
Sourcepub fn readers_of(
&self,
signal: &Coupling,
visit: &mut dyn FnMut(u8, &'static TaskNode),
)
pub fn readers_of( &self, signal: &Coupling, visit: &mut dyn FnMut(u8, &'static TaskNode), )
Every node declaring signal in its reads:. The counterpart to
writers_of; together they answer the structural
questions about one signal — who produces it, who consumes it, which
pairs are coupled in a loop.