pub struct QueryParamBuilder<T>(/* private fields */);Expand description
A SystemParamBuilder for a Query.
This takes a closure accepting an &mut QueryBuilder and uses the builder to construct the query’s state.
This can be used to add additional filters,
or to configure the components available to FilteredEntityRef or FilteredEntityMut.
§Example
let system = (QueryParamBuilder::new(|builder| {
builder.with::<Player>();
}),)
.build_state(&mut world)
.build_system(|query: Query<()>| {
for _ in &query {
// This only includes entities with a `Player` component.
}
});
// When collecting multiple builders into a `Vec`,
// use `new_box()` to erase the closure type.
let system = (vec![
QueryParamBuilder::new_box(|builder| {
builder.with::<Player>();
}),
QueryParamBuilder::new_box(|builder| {
builder.without::<Player>();
}),
],)
.build_state(&mut world)
.build_system(|query: Vec<Query<()>>| {});Implementations§
Source§impl<T> QueryParamBuilder<T>
impl<T> QueryParamBuilder<T>
Sourcepub fn new<D, F>(f: T) -> QueryParamBuilder<T>
pub fn new<D, F>(f: T) -> QueryParamBuilder<T>
Creates a SystemParamBuilder for a Query that accepts a callback to configure the QueryBuilder.
Source§impl<'a, D, F> QueryParamBuilder<Box<dyn FnOnce(&mut QueryBuilder<'_, D, F>) + 'a>>where
D: QueryData,
F: QueryFilter,
impl<'a, D, F> QueryParamBuilder<Box<dyn FnOnce(&mut QueryBuilder<'_, D, F>) + 'a>>where
D: QueryData,
F: QueryFilter,
Sourcepub fn new_box(
f: impl FnOnce(&mut QueryBuilder<'_, D, F>) + 'a,
) -> QueryParamBuilder<Box<dyn FnOnce(&mut QueryBuilder<'_, D, F>) + 'a>>
pub fn new_box( f: impl FnOnce(&mut QueryBuilder<'_, D, F>) + 'a, ) -> QueryParamBuilder<Box<dyn FnOnce(&mut QueryBuilder<'_, D, F>) + 'a>>
Creates a SystemParamBuilder for a Query that accepts a callback to configure the QueryBuilder.
This boxes the callback so that it has a common type and can be put in a Vec.
Trait Implementations§
Source§impl<T> Clone for QueryParamBuilder<T>where
T: Clone,
impl<T> Clone for QueryParamBuilder<T>where
T: Clone,
Source§fn clone(&self) -> QueryParamBuilder<T>
fn clone(&self) -> QueryParamBuilder<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'w, 's, D, F, T> SystemParamBuilder<Query<'w, 's, D, F>> for QueryParamBuilder<T>
impl<'w, 's, D, F, T> SystemParamBuilder<Query<'w, 's, D, F>> for QueryParamBuilder<T>
Source§fn build(self, world: &mut World) -> QueryState<D, F>
fn build(self, world: &mut World) -> QueryState<D, F>
Registers any
World access used by this SystemParam
and creates a new instance of this param’s State.Source§fn build_state(self, world: &mut World) -> SystemState<P>
fn build_state(self, world: &mut World) -> SystemState<P>
Create a
SystemState from a SystemParamBuilder.
To create a system, call SystemState::build_system on the result.Auto Trait Implementations§
impl<T> Freeze for QueryParamBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for QueryParamBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for QueryParamBuilder<T>where
T: Send,
impl<T> Sync for QueryParamBuilder<T>where
T: Sync,
impl<T> Unpin for QueryParamBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for QueryParamBuilder<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
Return the
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.