rust/hwphysics/src/physics.rs
changeset 15261 501dfa1c8deb
parent 15260 775d7efa4e5c
child 15266 b58f98bbc120
--- a/rust/hwphysics/src/physics.rs	Wed Jul 24 22:49:59 2019 +0300
+++ b/rust/hwphysics/src/physics.rs	Wed Jul 24 23:33:06 2019 +0300
@@ -93,6 +93,14 @@
         self.gear_ids.push(gear_id);
         self.shifts.push((*old_position, *new_position));
     }
+
+    pub fn iter(&self) -> impl Iterator<Item = (GearId, &FPPoint, &FPPoint)> {
+        self.gear_ids
+            .iter()
+            .cloned()
+            .zip(self.shifts.iter())
+            .map(|(id, (from, to))| (id, from, to))
+    }
 }
 
 impl PhysicsProcessor {