Created
November 28, 2016 19:13
-
-
Save icefoxen/35c09d71112ff3e4f90f58822de1b3f0 to your computer and use it in GitHub Desktop.
specs junk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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