mod graph { use std::collections::{HashMap, HashSet}; use std::vec::Vec; pub struct Graph { frame_graph : HashMap>, flags_graph : HashSet<(u32, bool)> } impl Graph { pub fn new() -> Graph { Graph{ frame_graph : HashMap::new(), flags_graph : HashSet::new(), } } pub fn add(&mut self, parent : u32, children : Vec){ self.frame_graph.insert(parent, children); self.flags_graph.insert((parent, false)); for &i in self.frame_graph.get(&parent).unwrap() { self.flags_graph.insert((i, false)); } } pub fn get(&self) -> &Graph { self.clone() } } } mod new_class{ use super::graph; } fn main(){ use crate::graph::Graph; let mut graph : Graph = Graph::new(); graph.add(1, vec![2, 3, 4]); graph.add(2, vec![9, 7, 6, 1]); graph.add(6, vec![12, 11, 19]); }