Returns the name of a graph. # Arguments `graph` - graph # Returns Name of a given graph # Example ``` # use ciphercore_base::graphs::create_context; let c = create_context().unwrap(); let g = c.create_graph().unwrap(); g.set_name("relu").unwrap(); assert_eq!(c.get_graph_name(g).unwrap(), "relu".to_owned()); ```
(&self, graph: Graph)
| 4145 | /// assert_eq!(c.get_graph_name(g).unwrap(), "relu".to_owned()); |
| 4146 | /// ``` |
| 4147 | pub fn get_graph_name(&self, graph: Graph) -> Result<String> { |
| 4148 | if graph.get_context() != *self { |
| 4149 | return Err(runtime_error!("The graph is in a different context")); |
| 4150 | } |
| 4151 | let cell = self.body.borrow(); |
| 4152 | Ok(cell |
| 4153 | .graphs_names |
| 4154 | .get(&graph.get_id()) |
| 4155 | .ok_or_else(|| runtime_error!("The graph does not have a name assigned"))? |
| 4156 | .clone()) |
| 4157 | } |
| 4158 | |
| 4159 | /// Returns the graph with a given name in this context. |
| 4160 | /// |
no test coverage detected