Trait HazardCollector

Source
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 Hazards. Used in ‘collision collection’ queries to avoid having to repeatedly check hazards induced by one that has already been detected.

Required Methods§

Source

fn contains_key(&self, hkey: HazKey) -> bool

Source

fn insert(&mut self, hkey: HazKey, entity: HazardEntity)

Source

fn remove_by_key(&mut self, hkey: HazKey)

Source

fn len(&self) -> usize

Source

fn iter(&self) -> impl Iterator<Item = (HazKey, &HazardEntity)>

Provided Methods§

Source

fn contains_entity(&self, entity: &HazardEntity) -> bool

Source

fn remove_by_entity(&mut self, entity: &HazardEntity)

Source

fn is_empty(&self) -> bool

Source

fn keys(&self) -> impl Iterator<Item = HazKey>

Source

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.

Implementors§