Get all of the nodes in this graph.
(&mut self)
| 298 | |
| 299 | /// Get all of the nodes in this graph. |
| 300 | pub fn nodes(&mut self) -> CudaResult<&[GraphNode]> { |
| 301 | if self.node_cache.is_none() { |
| 302 | unsafe { |
| 303 | let mut len = self.num_nodes()?; |
| 304 | let mut vec = Vec::with_capacity(len); |
| 305 | cuda::cuGraphGetNodes( |
| 306 | self.raw, |
| 307 | vec.as_mut_ptr() as *mut cuda::CUgraphNode, |
| 308 | &mut len as *mut usize, |
| 309 | ) |
| 310 | .to_result()?; |
| 311 | vec.set_len(len); |
| 312 | self.node_cache = Some(vec); |
| 313 | } |
| 314 | } |
| 315 | Ok(self.node_cache.as_ref().unwrap()) |
| 316 | } |
| 317 | |
| 318 | /// Creates a new graph from some flags. |
| 319 | pub fn new(flags: GraphCreationFlags) -> CudaResult<Self> { |
no test coverage detected