Struct oxygengine::prelude::ecs::With
pub struct With<Q, R>(/* private fields */);
Expand description
Transforms query Q
by skipping entities not satisfying query R
See also QueryBorrow::with
.
Example
let mut world = World::new();
let a = world.spawn((123, true, "abc"));
let b = world.spawn((456, false));
let c = world.spawn((42, "def"));
let entities = world.query::<With<&i32, &bool>>()
.iter()
.map(|(e, &i)| (e, i))
.collect::<Vec<_>>();
assert_eq!(entities.len(), 2);
assert!(entities.contains(&(a, 123)));
assert!(entities.contains(&(b, 456)));
Trait Implementations§
Auto Trait Implementations§
impl<Q, R> RefUnwindSafe for With<Q, R>where Q: RefUnwindSafe,
impl<Q, R> Send for With<Q, R>where Q: Send,
impl<Q, R> Sync for With<Q, R>where Q: Sync,
impl<Q, R> Unpin for With<Q, R>where Q: Unpin,
impl<Q, R> UnwindSafe for With<Q, R>where Q: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more