pub struct Single<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static = ()> { /* private fields */ }Expand description
Exactly one enabled, runtime-managed entity selected for a System.
Cardinality is a System precondition: if zero or multiple entities match,
parameter validation fails before the System body runs and Sim;Logic stops
the current stage with a crate::system::SystemRunFailure. Use
Query::single when absence or multiplicity is expected control flow
that the System should handle itself.
Like Query, this parameter always requires Sim;Logic’s private managed
identity and excludes Disabled entities independently of Bevy’s mutable
global default-query-filter Resource. crate::identity::LogicEntityRef
is the supported way to include the opaque entity handle in D.
Implementations§
Source§impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> Single<'w, 's, D, F>
impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> Single<'w, 's, D, F>
Sourcepub fn into_inner(self) -> D::Item<'w, 's>
pub fn into_inner(self) -> D::Item<'w, 's>
Returns the fetched query item without performing another lookup.
This is useful for tuple data containing mutable component borrows.
Trait Implementations§
Source§impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> Deref for Single<'w, 's, D, F>
impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> Deref for Single<'w, 's, D, F>
Source§impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> DerefMut for Single<'w, 's, D, F>
impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> DerefMut for Single<'w, 's, D, F>
impl<'w, 's, D: IterQueryData + 'static, F: QueryFilter + 'static> ReadOnlySystemParam for Single<'w, 's, D, F>where
BevySingle<'w, 's, D, (F, Allow<Disabled>, Without<Disabled>, With<ManagedEntity>)>: ReadOnlySystemParam,
Source§impl<D: IterQueryData + 'static, F: QueryFilter + 'static> SystemParam for Single<'_, '_, D, F>
impl<D: IterQueryData + 'static, F: QueryFilter + 'static> SystemParam for Single<'_, '_, D, F>
Source§type State = FetchState<D, F>
type State = FetchState<D, F>
Source§type Item<'w, 's> = Single<'w, 's, D, F>
type Item<'w, 's> = Single<'w, 's, D, F>
Self, instantiated with new lifetimes. Read moreSource§fn init_access(
state: &Self::State,
system_meta: &mut SystemMeta,
component_access_set: &mut FilteredAccessSet,
world: &mut World,
)
fn init_access( state: &Self::State, system_meta: &mut SystemMeta, component_access_set: &mut FilteredAccessSet, world: &mut World, )
Source§fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
SystemParam’s state.
This is used to apply Commands during ApplyDeferred.Source§fn queue(
state: &mut Self::State,
system_meta: &SystemMeta,
world: DeferredWorld<'_>,
)
fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )
ApplyDeferred.Source§unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick,
) -> Result<Self::Item<'w, 's>, SystemParamValidationError>
unsafe fn get_param<'w, 's>( state: &'s mut Self::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Result<Self::Item<'w, 's>, SystemParamValidationError>
SystemParamFunction. Read moreAuto Trait Implementations§
impl<'w, 's, D, F> Freeze for Single<'w, 's, D, F>
impl<'w, 's, D, F> RefUnwindSafe for Single<'w, 's, D, F>
impl<'w, 's, D, F> Send for Single<'w, 's, D, F>
impl<'w, 's, D, F> Sync for Single<'w, 's, D, F>
impl<'w, 's, D, F> Unpin for Single<'w, 's, D, F>
impl<'w, 's, D, F> UnsafeUnpin for Single<'w, 's, D, F>
impl<'w, 's, D, F> UnwindSafe for Single<'w, 's, D, F>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.