aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-10-05 16:51:16 +0200
committerCrozet Sébastien <developer@crozet.re>2020-10-05 16:51:16 +0200
commitd8dfd864a453a9ead60f970549b2d289d7025364 (patch)
treed809f168696a2408ee618eaea597cc8bb25c0740 /src
parent9c22e59416bd76b2a6e817e9e29692a22a3113e1 (diff)
downloadrapier-d8dfd864a453a9ead60f970549b2d289d7025364.tar.gz
rapier-d8dfd864a453a9ead60f970549b2d289d7025364.tar.bz2
rapier-d8dfd864a453a9ead60f970549b2d289d7025364.zip
Joint set iteration: also yield the joint handle.
Diffstat (limited to 'src')
-rw-r--r--src/dynamics/joint/joint_set.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dynamics/joint/joint_set.rs b/src/dynamics/joint/joint_set.rs
index 90f5190..2b1895f 100644
--- a/src/dynamics/joint/joint_set.rs
+++ b/src/dynamics/joint/joint_set.rs
@@ -66,17 +66,21 @@ impl JointSet {
}
/// Iterates through all the joint on this set.
- pub fn iter(&self) -> impl Iterator<Item = &Joint> {
- self.joint_graph.graph.edges.iter().map(|e| &e.weight)
+ pub fn iter(&self) -> impl Iterator<Item = (JointHandle, &Joint)> {
+ self.joint_graph
+ .graph
+ .edges
+ .iter()
+ .map(|e| (e.weight.handle, &e.weight))
}
/// Iterates mutably through all the joint on this set.
- pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Joint> {
+ pub fn iter_mut(&mut self) -> impl Iterator<Item = (JointHandle, &mut Joint)> {
self.joint_graph
.graph
.edges
.iter_mut()
- .map(|e| &mut e.weight)
+ .map(|e| (e.weight.handle, &mut e.weight))
}
// /// The set of joints as an array.