You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: diff_and_patch_module_graph.rs
    path of file: ./repos/farm/crates/compiler/src/update
    
    the code of the file until where you have to start completion: //! diff the module_graph and update_module_graph, analyze the changes and then patch the module_graph

use std::collections::{HashMap, HashSet, VecDeque};

use farmfe_core::module::{
  module_graph::{ModuleGraph, ModuleGraphEdge},
  Module, ModuleId,
};

/// the diff result of a module's dependencies
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct ModuleDepsDiffResult {
  /// added dependencies
  pub added: Vec<(ModuleId, ModuleGraphEdge)>,
  /// removed dependencies
  pub removed: Vec<(ModuleId, ModuleGraphEdge)>,
}

pub type ModuleDepsDiffResultMap = Vec<(ModuleId, ModuleDepsDiffResult)>;
/// the diff result of a module, this records all related changes of the module graph
/// for example, deeply added or removed dependencies also be recorded here
#[derive(Debug, Default, Clone)]
pub struct DiffResult {
  pub deps_changes: ModuleDepsDiffResultMap,
  pub added_modules: HashSet<ModuleId>,
  pub removed_modules: HashSet<ModuleId>,
}
#[cfg(test)]
impl DiffResult {
  pub fn readable_print(&self) {
    // prin
    
  pub fn readable_print(&self) {
    // print the diff result in a readable way
    // for example:
    // a ->
    //    added: b, c
    //    removed: d
    // b -> ..
    // removed_modules: e, f
    // added_modules: g, h

    for (module_id, deps_diff_result) in &self.deps_changes {
      println!("{:?} -> ", module_id);

      println!(
        "  added: {:?}",
        deps_diff_result
          .added
          .iter()
          .map(|(id, edge)| (
            id,
            edge
              .items()
              .iter()
              .map(|item| item.kind.clone())
              .collect::<Vec<_>>()
          ))
          .collect::<Vec<_>>()
      );

      println!(
        "  removed: {:?}",
        deps_diff_result
          .removed
          .iter()
          .map(|(id, edge)| (
            id,
            edge
              .items()
              .iter()
              .map(|item| item.kind.clone())
              .collect::<Vec<_>>()
          ))
          .collect::<Vec<_>>()
      );
    }

    println!("added_modules: {:?}", self.added_modules);

    println!("removed_modules: {:?}", self.removed_modules);
  }