Skip to main content

SpatialIndex

Trait SpatialIndex 

Source
pub trait SpatialIndex {
    // Required methods
    fn insert(&mut self, rule: CollisionRule) -> Result<()>;
    fn query(&self, bounds: Rect) -> Result<Vec<&CollisionRule>>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Deterministic spatial query contract.

Required Methods§

Source

fn insert(&mut self, rule: CollisionRule) -> Result<()>

Inserts one resolved rule.

Source

fn query(&self, bounds: Rect) -> Result<Vec<&CollisionRule>>

Returns overlapping rules in stable insertion order.

Source

fn len(&self) -> usize

Number of indexed rules.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether no rules are indexed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§