Created
September 11, 2020 06:01
-
-
Save BoxyUwU/84a2a677f1e2a82e2d11c78d2cf641e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fn testttt() { | |
let mut archetype = Archetype::new::<(u32, u64)>(); | |
archetype.add((10_u32, 12_u64)).unwrap(); | |
archetype.add((15_u32, 14_u64)).unwrap(); | |
archetype.add((20_u32, 16_u64)).unwrap(); | |
let mut query_borrow = QueryBorrow::<'_, (&mut u32, &u64)> { | |
lock_guards: vec![ | |
RwLockEitherGuard::WriteGuard(archetype.data.get_mut::<Vec<u32>>().unwrap().guard), | |
RwLockEitherGuard::ReadGuard(archetype.data.get::<Vec<u64>>().unwrap().guard), | |
], | |
phantom: PhantomData, | |
}; | |
let query_iter = | |
QueryIter::<'_, _, (EitherIter<_>, EitherIter<_>)>::from_borrows(&mut query_borrow); | |
for (n, (left, right)) in query_iter.enumerate() { | |
println!("{:?}, {:?}", left, right); | |
if n == 0 { | |
assert!(*left == 10); | |
assert!(*right == 12); | |
} else if n == 1 { | |
assert!(*left == 15); | |
assert!(*right == 14); | |
} else if n == 2 { | |
assert!(*left == 20); | |
assert!(*right == 16); | |
} else { | |
panic!("awd"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment