Skip to main content

HasGeometry

Trait HasGeometry 

Source
pub trait HasGeometry {
    // Required methods
    fn id(&self) -> usize;
    fn geometry(&self) -> &Geometry<Float>;

    // Provided method
    fn reorder(items: ConcreteVec<Self>) -> ConcreteVec<Self>
       where Self: Sized + 'static { ... }
}
Expand description

A trait for types that have a Geometry.

Helps abstract away this property so the helper methods can be generalized.

Required Methods§

Source

fn id(&self) -> usize

Get the id of the HasGeometry.

Source

fn geometry(&self) -> &Geometry<Float>

Get the Geometry of the HasGeometry.

Provided Methods§

Source

fn reorder(items: ConcreteVec<Self>) -> ConcreteVec<Self>
where Self: Sized + 'static,

Impose a canonical order on the items at build time. Defaults to leaving source order alone; override to make lookup results come back in a meaningful order.

A lookup returns candidates in the order their ids appear in the lookup cache, and the cache is built by walking the items in order — so item order is result order, and it costs nothing at runtime. An implementation that reorders must rewrite each item’s id to its new index, because id is the item’s position in this collection.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§