pub struct QTHazardVec { /* private fields */ }
Expand description
Vector of QTHazard
s, which always remains sorted by activeness then presence.
This is a performance optimization to be able to quickly return the “strongest” hazard
Strongest meaning the first active hazard with the highest presence (Entire
> Partial
> None
)
Implementations§
Source§impl QTHazardVec
impl QTHazardVec
pub fn new() -> Self
pub fn add(&mut self, haz: QTHazard)
pub fn remove(&mut self, haz_entity: HazardEntity) -> Option<QTHazard>
Sourcepub fn strongest(&self, h_i: &impl HazardIgnorer) -> Option<&QTHazard>
pub fn strongest(&self, h_i: &impl HazardIgnorer) -> Option<&QTHazard>
Returns the strongest hazard (if any), meaning the first active hazard with the highest QTHazPresence (Entire
> Partial
> None
)
Ignores any hazard present in irrelevant_hazards
.
pub fn get(&self, entity: HazardEntity) -> Option<&QTHazard>
pub fn activate_hazard(&mut self, entity: HazardEntity) -> bool
pub fn deactivate_hazard(&mut self, entity: HazardEntity) -> bool
pub fn active_hazards(&self) -> &[QTHazard]
pub fn all_hazards(&self) -> &[QTHazard]
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn has_only_entire_hazards(&self) -> bool
Trait Implementations§
Source§impl Clone for QTHazardVec
impl Clone for QTHazardVec
Source§fn clone(&self) -> QTHazardVec
fn clone(&self) -> QTHazardVec
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 moreAuto Trait Implementations§
impl Freeze for QTHazardVec
impl RefUnwindSafe for QTHazardVec
impl Send for QTHazardVec
impl Sync for QTHazardVec
impl Unpin for QTHazardVec
impl UnwindSafe for QTHazardVec
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> 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 more