github.com/charypar/monobuild@v0.0.0-20211122220434-fd884ed50212/rs/src/graph/partial_eq.rs (about) 1 use super::{Edge, Graph, Subgraph, Vertex}; 2 3 impl<V, E> PartialEq for Graph<V, E> 4 where 5 V: Vertex, 6 E: Edge, 7 { 8 fn eq(&self, other: &Self) -> bool { 9 self.iter() 10 .zip(other.iter()) 11 .all(|(a, b)| a.0.eq(b.0) && a.1.eq(b.1)) 12 } 13 } 14 15 impl<V, E> PartialEq for Subgraph<'_, V, E> 16 where 17 V: Vertex, 18 E: Edge, 19 { 20 fn eq(&self, other: &Self) -> bool { 21 self.iter() 22 .zip(other.iter()) 23 .all(|(a, b)| a.0.eq(b.0) && a.1.eq(b.1)) 24 } 25 } 26 27 impl<V, E> PartialEq<Subgraph<'_, V, E>> for Graph<V, E> 28 where 29 V: Vertex, 30 E: Edge, 31 { 32 fn eq(&self, other: &Subgraph<'_, V, E>) -> bool { 33 self.iter() 34 .zip(other.iter()) 35 .all(|(a, b)| a.0.eq(b.0) && a.1.eq(b.1)) 36 } 37 } 38 39 impl<V, E> PartialEq<Graph<V, E>> for Subgraph<'_, V, E> 40 where 41 V: Vertex, 42 E: Edge, 43 { 44 fn eq(&self, other: &Graph<V, E>) -> bool { 45 self.iter() 46 .zip(other.iter()) 47 .all(|(a, b)| a.0.eq(b.0) && a.1.eq(b.1)) 48 } 49 }