Promotes a given node to the output node of the parent graph. # Arguments `output_node` - node to be set as output # Example ``` # use ciphercore_base::graphs::create_context; # use ciphercore_base::data_types::{array_type, vector_type, INT32}; let c = create_context().unwrap(); let g = c.create_graph().unwrap(); let t = array_type(vec![3, 2], INT32); let vec_t = vector_type(4, t); let n1 = g.
(&self, output_node: Node)
| 3182 | /// g.finalize().unwrap(); |
| 3183 | /// ``` |
| 3184 | pub fn set_output_node(&self, output_node: Node) -> Result<()> { |
| 3185 | let current_output_node = self.body.borrow().output_node.clone(); |
| 3186 | match current_output_node { |
| 3187 | Some(_) => Err(runtime_error!("Output node is already set")), |
| 3188 | None => { |
| 3189 | if output_node.get_graph() != *self { |
| 3190 | Err(runtime_error!("Output node has to be from the same graph")) |
| 3191 | } else { |
| 3192 | self.body.borrow_mut().output_node = Some(output_node.downgrade()); |
| 3193 | Ok(()) |
| 3194 | } |
| 3195 | } |
| 3196 | } |
| 3197 | } |
| 3198 | |
| 3199 | /// Returns the output node of the graph. |
| 3200 | /// |