Skip to content

Instantly share code, notes, and snippets.

@icefoxen
Created November 28, 2016 19:13
Show Gist options
  • Save icefoxen/35c09d71112ff3e4f90f58822de1b3f0 to your computer and use it in GitHub Desktop.
Save icefoxen/35c09d71112ff3e4f90f58822de1b3f0 to your computer and use it in GitHub Desktop.
specs junk
// This works...
use specs::Join;
let world = self.planner.mut_world();
let r1 = world.read::<CPosition>();
for pos in r1.iter() {
println!("Position is: {:?}", pos);
}
// This does not...
use specs::Join;
let world = self.planner.mut_world();
let r1 = world.read::<CPosition>();
let r2 = world.read::<CPlayer>();
for (pos, player) in (r1, r2).iter() {
println!("Position is: {:?}", pos);
}
With this error:
rror: no method named `iter` found for type `(specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>>, specs::Storage<CPlayer, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPlayer>>>)` in the current scope
--> src/main.rs:108:39
|
108 | for (pos, player) in (r1, r2).iter() {
| ^^^^
|
= note: the method `iter` exists but the following trait bounds were not satisfied: `specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>> : specs::Join`, `specs::Storage<CPlayer, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPlayer>>> : specs::Join`, `specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>> : specs::Join`, `specs::Storage<CPlayer, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPlayer>>> : specs::Join`
@icefoxen
Copy link
Author

Even if it's just an a single item in the tuple:

error: no method named iter found for type
(specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>>,) in the current scope
--> src/main.rs:108:39
|
108 | for (pos,) in (r1,).iter() {
| ^^^^
|
= note: the method iter exists but the following trait bounds were not satisfied:
specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>> : specs::Join,
specs::Storage<CPosition, std::sync::RwLockReadGuard<'_, specs::Allocator>, std::sync::RwLockReadGuard<'_, specs::MaskedStorage<CPosition>>> : specs::Join

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment