| 49 | |
| 50 | impl DynamicExecutor { |
| 51 | pub async fn new(proto_network: ProtoNetwork) -> Result<Self, GraphErrors> { |
| 52 | let mut typing_context = TypingContext::new(&node_registry::NODE_REGISTRY); |
| 53 | typing_context.update(&proto_network)?; |
| 54 | let output = proto_network.output; |
| 55 | let tree = BorrowTree::new(proto_network, &typing_context).await?; |
| 56 | |
| 57 | Ok(Self { |
| 58 | tree, |
| 59 | output, |
| 60 | typing_context, |
| 61 | orphaned_nodes: HashSet::new(), |
| 62 | }) |
| 63 | } |
| 64 | |
| 65 | /// Updates the existing [`BorrowTree`] to reflect the new [`ProtoNetwork`], reusing nodes where possible. |
| 66 | #[cfg_attr(debug_assertions, inline(never))] |