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

Method vertex_keys

publication/code/chapter09/graph_adjlist.rs:104–111  ·  view source on GitHub ↗

获取所有节点的 key

(&self)

Source from the content-addressed store, hash-verified

102
103 // 获取所有节点的 key
104 fn vertex_keys(&self) -> Vec<T> {
105 let mut keys = Vec::new();
106 for key in self.vertices.keys() {
107 keys.push(key.clone());
108 }
109
110 keys
111 }
112
113 // 删除点 (同时要删除边)
114 fn remove_vertex(&mut self, key: &T) -> Option<Vertex<T>> {

Callers 2

remove_vertexMethod · 0.45
mainFunction · 0.45

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected