pub trait HazardCollector: HazardFilter {
// Required methods
fn contains_key(&self, hkey: HazKey) -> bool;
fn insert(&mut self, hkey: HazKey, entity: HazardEntity);
fn remove_by_key(&mut self, hkey: HazKey);
fn len(&self) -> usize;
fn iter(&self) -> impl Iterator<Item = (HazKey, &HazardEntity)>;
// Provided methods
fn contains_entity(&self, entity: &HazardEntity) -> bool { ... }
fn remove_by_entity(&mut self, entity: &HazardEntity) { ... }
fn is_empty(&self) -> bool { ... }
fn keys(&self) -> impl Iterator<Item = HazKey> { ... }
fn entities(&self) -> impl Iterator<Item = &HazardEntity> { ... }
}
Expand description
Trait for structs that can track and store detected Hazard
s.
Used in ‘collision collection’ queries to avoid having to repeatedly check hazards induced by one that has already been detected.
Required Methods§
fn contains_key(&self, hkey: HazKey) -> bool
fn insert(&mut self, hkey: HazKey, entity: HazardEntity)
fn remove_by_key(&mut self, hkey: HazKey)
fn len(&self) -> usize
fn iter(&self) -> impl Iterator<Item = (HazKey, &HazardEntity)>
Provided Methods§
fn contains_entity(&self, entity: &HazardEntity) -> bool
fn remove_by_entity(&mut self, entity: &HazardEntity)
fn is_empty(&self) -> bool
fn keys(&self) -> impl Iterator<Item = HazKey>
fn entities(&self) -> impl Iterator<Item = &HazardEntity>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.