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

Method contains

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

Source from the content-addressed store, hash-verified

79 }
80
81 fn contains(&self, key: &T) -> bool {
82 for (nbr, _vertex) in self.vertices.iter() {
83 if nbr == key { return true; }
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