Skip to main content

compose_graph

Macro compose_graph 

Source
macro_rules! compose_graph {
    (name: $n:ident, fragments: [$f:path $(, $r:path)* $(,)?], graph: {$($g:tt)*}) => { ... };
    (fragments: [$f:path $(, $r:path)* $(,)?], graph: {$($g:tt)*}) => { ... };
    (@next [], {$($acc:tt)*}, {$($g:tt)*}) => { ... };
    (@next [$f:path $(, $r:path)*], {$($acc:tt)*}, $g:tt) => { ... };
}
Expand description

Assemble one graph from supervisor_fragment! relays plus compose-site items:

embassy_supervisor::compose_graph! {
    fragments: [::net_stack::NET_FRAG, HTTP_FRAG],
    graph: {
        node APP = Terminate, deps: [NET], task: app_worker; // cross-fragment dep
    }
}

Fragments expand in listed order, then the graph: items; everything reaches ONE supervisor_graph! expansion, so cross-fragment deps resolve by name (forward references included) and every compile-time pass — name map, u8 slot indices, topological order, shared-slot dedup, the 256-node cap — checks the whole composed graph. One compose site per binary (it emits the usual GRAPH/NODES/DEPS statics and, under trace-hooks, the hook symbols). Name collisions across fragments hit the ordinary duplicate-name errors, attributed to the owning fragment; prefix fragment-public names.