MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / add_vertex

Method add_vertex

publication/code/chapter09/graph_adjlist.rs:89–93  ·  view source on GitHub ↗
(&mut self, key: &T)

Source from the content-addressed store, hash-verified

87 }
88
89 fn add_vertex(&mut self, key: &T) -> Option<Vertex<T>> {
90 let vertex = Vertex::new(key.clone());
91 self.vertnums += 1;
92 self.vertices.insert(key.clone(), vertex)
93 }
94
95 fn get_vertex(&self, key: &T) -> Option<&Vertex<T>> {
96 if let Some(vertex) = self.vertices.get(key) {

Callers 2

add_edgeMethod · 0.45
mainFunction · 0.45

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected