1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
use super::super::super::box2d::dynamics::fixture::*; use super::super::super::box2d::dynamics::body::*; pub struct FixtureIterator { fixture: Option<Fixture>, started: bool } impl Body { pub fn get_fixture_iterator(&mut self) -> FixtureIterator { FixtureIterator { fixture: self.get_fixture_list(), started: false } } } impl Iterator for FixtureIterator { type Item = Fixture; fn next(&mut self) -> Option<Fixture> { if !self.started { self.started = true; } else { self.fixture = match self.fixture { Some(ref x) => x.get_next(), None => None } } self.fixture.clone() } }