impl IntoIterator for EntityList, so entities can be easily iterated
This commit is contained in:
parent
5f63a69c38
commit
201b51e85c
2 changed files with 12 additions and 0 deletions
|
|
@ -159,3 +159,12 @@ impl DecoderCtx<EntityEncoding, EntityEncoding> for EntityList {
|
|||
self.enc_size
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> IntoIterator for &'a EntityList {
|
||||
type Item = &'a Entity;
|
||||
type IntoIter = std::slice::Iter<'a, Entity>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.ents.iter()
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,9 @@ impl World {
|
|||
self.entlist
|
||||
.encode(EntityEncoding::File)?
|
||||
.dump(Path::new("D:\\entlist.ent"))?;*/
|
||||
for ent in &self.entlist {
|
||||
println!("{}", ent.type_idx);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue