pub struct BehaviorRefItem<'__w, T: Behavior> { /* private fields */ }
Expand description
Automatically generated WorldQuery
item type for BehaviorRef
, returned when iterating over query results.
Implementations§
Source§impl<T: Behavior> BehaviorRefItem<'_, T>
impl<T: Behavior> BehaviorRefItem<'_, T>
Sourcepub fn index(&self) -> BehaviorIndex
pub fn index(&self) -> BehaviorIndex
Returns the BehaviorIndex
associated with the current Behavior
state.
Sourcepub fn has_index(&self, index: BehaviorIndex) -> bool
pub fn has_index(&self, index: BehaviorIndex) -> bool
Returns true
if the given BehaviorIndex
matches a state in this Behavior
stack.
Sourcepub fn iter(&self) -> impl Iterator<Item = &T> + '_
pub fn iter(&self) -> impl Iterator<Item = &T> + '_
Returns an iterator over all Behavior
states in the stack, including the current one.
The iterator is ordered from the initial behavior (index = 0) to the current one.
Sourcepub fn has_transition(&self) -> bool
pub fn has_transition(&self) -> bool
Returns true
if there is any pending Transition
for this Behavior
.
§Usage
By design, only one transition is allowed per transition
cycle.
The only exception to this rule is if the behavior is interrupted or reset where multiple states may be stopped within a single cycle.
If a transition is requested while another is pending, it would be overriden.
The transition helper methods start
, interrupt_start
,
stop
and reset
all trigger a warning in this case.
Because of this, this method is useful to avoid unintentional transition overrides.
Sourcepub fn has_sequence(&self) -> bool
pub fn has_sequence(&self) -> bool
Returns true
if there is any TransitionSequence
running on this Behavior
.
This is useful to allow transition sequences to finish before starting a new behavior.
Trait Implementations§
Source§impl<T: Behavior> AsRef<T> for BehaviorRefItem<'_, T>
impl<T: Behavior> AsRef<T> for BehaviorRefItem<'_, T>
Source§impl<T: Behavior> Deref for BehaviorRefItem<'_, T>
impl<T: Behavior> Deref for BehaviorRefItem<'_, T>
Source§impl<T: Behavior> DetectChanges for BehaviorRefItem<'_, T>
impl<T: Behavior> DetectChanges for BehaviorRefItem<'_, T>
Source§fn is_changed(&self) -> bool
fn is_changed(&self) -> bool
true
if this value was added or mutably dereferenced
either since the last time the system ran or, if the system never ran,
since the beginning of the program. Read moreSource§fn last_changed(&self) -> Tick
fn last_changed(&self) -> Tick
Source§fn changed_by(&self) -> MaybeLocation
fn changed_by(&self) -> MaybeLocation
Source§impl<T: Behavior> Index<BehaviorIndex> for BehaviorRefItem<'_, T>
impl<T: Behavior> Index<BehaviorIndex> for BehaviorRefItem<'_, T>
Auto Trait Implementations§
impl<'__w, T> Freeze for BehaviorRefItem<'__w, T>
impl<'__w, T> RefUnwindSafe for BehaviorRefItem<'__w, T>where
T: RefUnwindSafe,
impl<'__w, T> Send for BehaviorRefItem<'__w, T>
impl<'__w, T> Sync for BehaviorRefItem<'__w, T>
impl<'__w, T> Unpin for BehaviorRefItem<'__w, T>
impl<'__w, T> UnwindSafe for BehaviorRefItem<'__w, T>where
T: RefUnwindSafe,
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
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>
, 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>
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)
&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.