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

Method contains

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

Source from the content-addressed store, hash-verified

77 fn edge_num(&self) -> u32 { self.edgenums }
78
79 fn contains(&self, key: &T) -> bool {
80 for (nbr, _vertex) in self.vertices.iter() {
81 if nbr == key {
82 return true;
83 }
84 }
85
86 false
87 }
88
89 fn add_vertex(&mut self, key: &T) -> Option<Vertex<T>> {
90 let vertex = Vertex::new(key.clone());

Callers 1

add_edgeMethod · 0.45

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected