pub struct ParamBuilder;
Expand description
A SystemParamBuilder
for any SystemParam
that uses its default initialization.
§Example
fn my_system(res: Res<R>, param: MyParam, query: Query<&A>) {
// ...
}
let system = (
// A plain ParamBuilder can build any parameter type.
ParamBuilder,
// The `of::<P>()` method returns a `ParamBuilder`
// typed as `impl SystemParamBuilder<P>`.
ParamBuilder::of::<MyParam>(),
// The other factory methods return typed builders
// for common parameter types.
ParamBuilder::query::<&A>(),
)
.build_state(&mut world)
.build_system(my_system);
Implementations§
Source§impl ParamBuilder
impl ParamBuilder
Sourcepub fn of<T: SystemParam>() -> impl SystemParamBuilder<T>
pub fn of<T: SystemParam>() -> impl SystemParamBuilder<T>
Creates a SystemParamBuilder
for any SystemParam
that uses its default initialization.
Sourcepub fn resource<'w, T: Resource>() -> impl SystemParamBuilder<Res<'w, T>>
pub fn resource<'w, T: Resource>() -> impl SystemParamBuilder<Res<'w, T>>
Helper method for reading a Resource
as a param, equivalent to of::<Res<T>>()
Sourcepub fn resource_mut<'w, T: Resource>() -> impl SystemParamBuilder<ResMut<'w, T>>
pub fn resource_mut<'w, T: Resource>() -> impl SystemParamBuilder<ResMut<'w, T>>
Helper method for mutably accessing a Resource
as a param, equivalent to of::<ResMut<T>>()
Sourcepub fn local<'s, T: FromWorld + Send + 'static>() -> impl SystemParamBuilder<Local<'s, T>>
pub fn local<'s, T: FromWorld + Send + 'static>() -> impl SystemParamBuilder<Local<'s, T>>
Helper method for adding a Local
as a param, equivalent to of::<Local<T>>()
Sourcepub fn query<'w, 's, D: QueryData + 'static>() -> impl SystemParamBuilder<Query<'w, 's, D, ()>>
pub fn query<'w, 's, D: QueryData + 'static>() -> impl SystemParamBuilder<Query<'w, 's, D, ()>>
Helper method for adding a Query
as a param, equivalent to of::<Query<D>>()
Sourcepub fn query_filtered<'w, 's, D: QueryData + 'static, F: QueryFilter + 'static>() -> impl SystemParamBuilder<Query<'w, 's, D, F>>
pub fn query_filtered<'w, 's, D: QueryData + 'static, F: QueryFilter + 'static>() -> impl SystemParamBuilder<Query<'w, 's, D, F>>
Helper method for adding a filtered Query
as a param, equivalent to of::<Query<D, F>>()
Trait Implementations§
Source§impl Clone for ParamBuilder
impl Clone for ParamBuilder
Source§fn clone(&self) -> ParamBuilder
fn clone(&self) -> ParamBuilder
Returns a copy 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 Debug for ParamBuilder
impl Debug for ParamBuilder
Source§impl Default for ParamBuilder
impl Default for ParamBuilder
Source§fn default() -> ParamBuilder
fn default() -> ParamBuilder
Returns the “default value” for a type. Read more
Source§impl<P: SystemParam> SystemParamBuilder<P> for ParamBuilder
impl<P: SystemParam> SystemParamBuilder<P> for ParamBuilder
Source§fn build(self, world: &mut World, meta: &mut SystemMeta) -> P::State
fn build(self, world: &mut World, meta: &mut SystemMeta) -> P::State
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.impl Copy for ParamBuilder
Auto Trait Implementations§
impl Freeze for ParamBuilder
impl RefUnwindSafe for ParamBuilder
impl Send for ParamBuilder
impl Sync for ParamBuilder
impl Unpin for ParamBuilder
impl UnwindSafe for ParamBuilder
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
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>
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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.