tidu/primitive_graph.rs
1use computegraph::graph::Graph;
2use computegraph::GraphOperation;
3
4/// Borrowed primitive computation graph passed to downstream executors.
5pub struct PrimitiveGraph<'a, Op: GraphOperation> {
6 graph: &'a Graph<Op>,
7}
8
9impl<'a, Op: GraphOperation> PrimitiveGraph<'a, Op> {
10 pub(crate) fn new(graph: &'a Graph<Op>) -> Self {
11 Self { graph }
12 }
13
14 /// Borrow the lower-level graph representation.
15 pub fn as_graph(&self) -> &Graph<Op> {
16 self.graph
17 }
18}