Skip to main content

trellis_core/
graph_support.rs

1use crate::Graph;
2impl<C, O: Clone> Clone for Graph<C, O> {
3    fn clone(&self) -> Self {
4        Self {
5            next_node_id: self.next_node_id,
6            next_scope_id: self.next_scope_id,
7            next_output_key: self.next_output_key,
8            next_transaction_id: self.next_transaction_id,
9            revision: self.revision,
10            nodes: self.nodes.clone(),
11            scopes: self.scopes.clone(),
12            input_values: self.input_values.clone(),
13            derived_specs: self.derived_specs.clone(),
14            derived_values: self.derived_values.clone(),
15            collection_specs: self.collection_specs.clone(),
16            collection_values: self.collection_values.clone(),
17            previous_collection_values: self.previous_collection_values.clone(),
18            collection_diffs: self.collection_diffs.clone(),
19            resource_planners: self.resource_planners.clone(),
20            resource_owners: self.resource_owners.clone(),
21            output_specs: self.output_specs.clone(),
22            output_values: self.output_values.clone(),
23            outputs: self.outputs.clone(),
24            audit: self.audit.clone(),
25            transaction_open: self.transaction_open,
26        }
27    }
28}
29
30impl Graph<(), ()> {
31    /// Creates an empty graph with no resource command payload type.
32    pub fn new() -> Self {
33        Self::new_with_command_type()
34    }
35}
36
37impl<O> Graph<(), O> {
38    /// Creates an empty graph with a materialized output payload type.
39    pub fn new_with_output_type() -> Self {
40        Self::new_with_command_type()
41    }
42}
43
44impl<C, O> Default for Graph<C, O> {
45    fn default() -> Self {
46        Self::new_with_command_type()
47    }
48}