pub trait ConditionalInsertComponentsExt {
Show 13 methods
fn insert_if<C: Component>(
&mut self,
condition: bool,
component: C
) -> &mut Self;
fn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component: impl FnOnce() -> C
) -> &mut Self;
fn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self;
fn insert_bundle_if<B: Bundle>(
&mut self,
condition: bool,
bundle: B
) -> &mut Self;
fn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle: impl FnOnce() -> B
) -> &mut Self;
fn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self;
fn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: impl FnOnce() -> A,
else_bundle: impl FnOnce() -> B
) -> &mut Self;
fn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self;
fn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self;
fn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self;
fn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self;
fn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
else_bundle: B
) -> &mut Self;
fn insert_bundle_some_or_else<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: impl FnOnce() -> B
) -> &mut Self;
}
Required Methods
fn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component: impl FnOnce() -> C
) -> &mut Self
fn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self
fn insert_bundle_if<B: Bundle>(&mut self, condition: bool, bundle: B) -> &mut Self
fn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle: impl FnOnce() -> B
) -> &mut Self
fn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self
fn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: impl FnOnce() -> A,
else_bundle: impl FnOnce() -> B
) -> &mut Self
fn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self
fn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self
fn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self
fn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self
fn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
else_bundle: B
) -> &mut Self
fn insert_bundle_some_or_else<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: impl FnOnce() -> B
) -> &mut Self
Implementations on Foreign Types
sourceimpl ConditionalInsertComponentsExt for EntityCommands<'_, '_, '_>
impl ConditionalInsertComponentsExt for EntityCommands<'_, '_, '_>
sourcefn insert_if<C: Component>(&mut self, condition: bool, component: C) -> &mut Self
fn insert_if<C: Component>(&mut self, condition: bool, component: C) -> &mut Self
if condition
, add a [Component
] to the entity
sourcefn insert_bundle_if<B: Bundle>(&mut self, condition: bool, bundle: B) -> &mut Self
fn insert_bundle_if<B: Bundle>(&mut self, condition: bool, bundle: B) -> &mut Self
if condition
, add a [Bundle
] to the entity
sourcefn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self
fn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self
if condition
, add a [Component
] to the entity
else add other [Component
] to the entity
sourcefn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self
fn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self
if condition
, add a [Bundle
] to the entity
else add other [Bundle
] to the entity
sourcefn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self
fn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self
If present, insert the inner value of optional_component
sourcefn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self
fn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self
If present, insert the inner value of optional_component
otherwise insert the component returned by otherwise
sourcefn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self
fn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self
If present, insert the inner value of optional_bundle
sourcefn insert_bundle_some_or_else<B: Bundle, A: Bundle>(
&mut self,
optional_bundle: Option<B>,
otherwise: impl FnOnce() -> A
) -> &mut Self
fn insert_bundle_some_or_else<B: Bundle, A: Bundle>(
&mut self,
optional_bundle: Option<B>,
otherwise: impl FnOnce() -> A
) -> &mut Self
If present, insert the inner value of optional_bundle
otherwise insert the component returned by otherwise
sourcefn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component_fn: impl FnOnce() -> C
) -> &mut Self
fn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component_fn: impl FnOnce() -> C
) -> &mut Self
If condition, compute a component from a closure and insert it
sourcefn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> B
) -> &mut Self
fn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> B
) -> &mut Self
If condition, compute a bundle from a closure and insert it
sourcefn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> A,
else_bundle_fn: impl FnOnce() -> B
) -> &mut Self
fn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> A,
else_bundle_fn: impl FnOnce() -> B
) -> &mut Self
If condition, compute a component from bundle_fn and insert it otherwise compute a bundle from else_bundle_fn and insert it
sourcefn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self
fn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self
Insert inner value of optional_component or if none, insert otherwise
sourcefn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: B
) -> &mut Self
fn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: B
) -> &mut Self
Insert inner value of optional_bundle or if none, insert otherwise
sourceimpl ConditionalInsertComponentsExt for EntityMut<'_>
impl ConditionalInsertComponentsExt for EntityMut<'_>
sourcefn insert_if<C: Component>(&mut self, condition: bool, component: C) -> &mut Self
fn insert_if<C: Component>(&mut self, condition: bool, component: C) -> &mut Self
if condition
, add a [Component
] to the entity
sourcefn insert_bundle_if<B: Bundle>(&mut self, condition: bool, bundle: B) -> &mut Self
fn insert_bundle_if<B: Bundle>(&mut self, condition: bool, bundle: B) -> &mut Self
if condition
, add a [Bundle
] to the entity
sourcefn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self
fn insert_if_else<C: Component, D: Component>(
&mut self,
condition: bool,
component: C,
else_component: D
) -> &mut Self
if condition
, add a [Component
] to the entity
else add other [Component
] to the entity
sourcefn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self
fn insert_bundle_if_else<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle: A,
else_bundle: B
) -> &mut Self
if condition
, add a [Bundle
] to the entity
else add other [Bundle
] to the entity
sourcefn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self
fn insert_some<C: Component>(
&mut self,
optional_component: Option<C>
) -> &mut Self
If present, insert the inner value of optional_component
sourcefn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self
fn insert_some_or_else<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: impl FnOnce() -> D
) -> &mut Self
If present, insert the inner value of optional_component
otherwise insert the component returned by otherwise
sourcefn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self
fn insert_bundle_some<B: Bundle>(
&mut self,
optional_bundle: Option<B>
) -> &mut Self
If present, insert the inner value of optional_bundle
sourcefn insert_bundle_some_or_else<B: Bundle, A: Bundle>(
&mut self,
optional_bundle: Option<B>,
otherwise: impl FnOnce() -> A
) -> &mut Self
fn insert_bundle_some_or_else<B: Bundle, A: Bundle>(
&mut self,
optional_bundle: Option<B>,
otherwise: impl FnOnce() -> A
) -> &mut Self
If present, insert the inner value of optional_bundle
otherwise insert the component returned by otherwise
sourcefn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component_fn: impl FnOnce() -> C
) -> &mut Self
fn insert_if_lazy<C: Component>(
&mut self,
condition: bool,
component_fn: impl FnOnce() -> C
) -> &mut Self
If condition, compute a component from a closure and insert it
sourcefn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> B
) -> &mut Self
fn insert_bundle_if_lazy<B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> B
) -> &mut Self
If condition, compute a bundle from a closure and insert it
sourcefn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> A,
else_bundle_fn: impl FnOnce() -> B
) -> &mut Self
fn insert_bundle_if_else_lazy<A: Bundle, B: Bundle>(
&mut self,
condition: bool,
bundle_fn: impl FnOnce() -> A,
else_bundle_fn: impl FnOnce() -> B
) -> &mut Self
If condition, compute a component from bundle_fn and insert it otherwise compute a bundle from else_bundle_fn and insert it
sourcefn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self
fn insert_some_or<C: Component, D: Component>(
&mut self,
optional_component: Option<C>,
otherwise: D
) -> &mut Self
Insert inner value of optional_component or if none, insert otherwise
sourcefn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: B
) -> &mut Self
fn insert_bundle_some_or<A: Bundle, B: Bundle>(
&mut self,
optional_bundle: Option<A>,
otherwise: B
) -> &mut Self
Insert inner value of optional_bundle or if none, insert otherwise