message: Adds mutable iterators for radeco_containers
diff: @@ -307,6 +307,15 @@ pub struct ModuleIter<'m> {
  iter: slice::Iter<'m, RadecoModule>,
  }
  +// TODO: Add a way to access the project
  +pub struct ZippedModuleMut<'m> {
  + pub module: &'m mut RadecoModule,
  +}
  +
  +pub struct ModuleIterMut<'m> {
  + iter: slice::IterMut<'m, RadecoModule>,
  +}
  +
  impl<'m> Iterator for ModuleIter<'m> {
  type Item = ZippedModule<'m>;
  fn next(&mut self) -> Option<ZippedModule<'m>> {
  @@ -321,6 +330,19 @@ impl<'m> Iterator for ModuleIter<'m> {
  }
  }
  +impl<'m> Iterator for ModuleIterMut<'m> {
  + type Item = ZippedModuleMut<'m>;
  + fn next(&mut self) -> Option<ZippedModuleMut<'m>> {
  + if let Some(rmod) = self.iter.next() {
  + Some(ZippedModuleMut {
  + module: rmod,
  + })
  + } else {
  + None
  + }
  + }
  +}
  +
  pub struct ZippedFunction<'f> {
  pub module: &'f RadecoModule,
  pub function: (&'f u64, &'f RadecoFunction),
  @@ -331,6 +353,16 @@ pub struct FunctionIter<'f> {
  iter: btree_map::Iter<'f, u64, RadecoFunction>,
  }
  +// TODO: Add a way to access module
  +pub struct ZippedFunctionMut<'f> {
  + pub function: (&'f u64, &'f mut RadecoFunction),
  +}
  +
  +pub struct FunctionIterMut<'f> {
  + iter: btree_map::IterMut<'f, u64, RadecoFunction>,
  +}
  +
  +
  impl<'f> Iterator for FunctionIter<'f> {
  type Item = ZippedFunction<'f>;
  fn next(&mut self) -> Option<ZippedFunction<'f>> {
  @@ -345,6 +377,19 @@ impl<'f> Iterator for FunctionIter<'f> {
  }
  }
  +impl<'f> Iterator for FunctionIterMut<'f> {
  + type Item = ZippedFunctionMut<'f>;
  + fn next(&mut self) -> Option<ZippedFunctionMut<'f>> {
  + if let Some(rfn) = self.iter.next() {
  + Some(ZippedFunctionMut {
  + function: rfn,
  + })
  + } else {
  + None
  + }
  + }
  +}
  +
  #[derive(Default)]
  /// Module-level loader used to construct a `RadecoModule`
  pub struct ModuleLoader<'a> {
  @@ -635,6 +680,12 @@ impl RadecoProject {
  iter: self.modules.iter(),
  }
  }
  +
  + pub fn iter_mut<'a>(&'a mut self) -> ModuleIterMut<'a> {
  + ModuleIterMut {
  + iter: self.modules.iter_mut()
  + }
  + }
  }
  impl RadecoModule {
  @@ -658,6 +709,12 @@ impl RadecoModule {
  iter: self.functions.iter(),
  }
  }
  +
  + pub fn iter_mut<'a>(&'a mut self) -> FunctionIterMut<'a> {
  + FunctionIterMut {
  + iter: self.functions.iter_mut(),
  + }
  + }
  }
  impl RadecoFunction {
  