Skip to main content

FnQuery

Struct FnQuery 

Source
pub struct FnQuery<'a, T> { /* private fields */ }

Implementations§

Source§

impl<'a, T> FnQuery<'a, T>

Source

pub fn new(entities: &'a Entities) -> Self

Source§

impl<'a, T> FnQuery<'a, T>

Source

pub fn iter(&self) -> FnQueryIterator<'a, T::ReturnType>

Examples found in repository?
examples/entities.rs (line 164)
163fn print_healths_and_speeds(healths: FnQuery<&Health>, speeds: FnQuery<&Speed>) {
164    for health in healths.iter() {
165        println!("{:?}", health);
166    }
167    for health in healths.iter() {
168        println!("{:?}", health);
169    }
170    for speed in speeds.into_iter() {
171        println!("{:?}", speed);
172    }
173}
174
175fn print_healths(healths: FnQuery<&Health>) {
176    for health in healths.into_iter() {
177        println!("{:?}", health);
178    }
179}
180
181fn change_healths(healths: FnQuery<&mut Health>) {
182    for mut health in healths.into_iter() {
183        health.0 += 100;
184    }
185}
186
187fn print_two(query: FnQuery<(&Speed, &Enemy)>) {
188    // support tuple destructuring
189    for (speed, _) in query.iter() {
190        println!("Enemy: {:?}", speed);
191    }
192}

Trait Implementations§

Source§

impl<'a, T> IntoIterator for FnQuery<'a, T>

Source§

type Item = <T as FnQueryContainedTupleType<'a>>::ReturnType

The type of the elements being iterated over.
Source§

type IntoIter = FnQueryIterator<'a, <T as FnQueryContainedTupleType<'a>>::ReturnType>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> QueryParameterType<'a> for FnQuery<'a, T>

Source§

fn get(entities: &'a Entities) -> Self
where Self: Sized,

Auto Trait Implementations§

§

impl<'a, T> Freeze for FnQuery<'a, T>

§

impl<'a, T> !RefUnwindSafe for FnQuery<'a, T>

§

impl<'a, T> !Send for FnQuery<'a, T>

§

impl<'a, T> !Sync for FnQuery<'a, T>

§

impl<'a, T> Unpin for FnQuery<'a, T>

§

impl<'a, T> UnsafeUnpin for FnQuery<'a, T>

§

impl<'a, T> !UnwindSafe for FnQuery<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.