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