Trait rust_sc2::distance::DistanceSlice[][src]

pub trait DistanceSlice<T> {
    fn sort_by_distance<P: Into<Point2>>(&mut self, target: P);
fn sort_unstable_by_distance<P: Into<Point2>>(&mut self, target: P); }
Expand description

Helper trait for sorting by distance slice and Vec of elements implementing Distance.

Required methods

fn sort_by_distance<P: Into<Point2>>(&mut self, target: P)[src]

Sorts slice by distance to target.

This sort is stable (i.e., does not reorder equal elements) and O(n * log(n)) worst-case.

When applicable, unstable sorting is preferred because it is generally faster than stable sorting and it doesn’t allocate auxiliary memory. See sort_unstable_by_distance.

fn sort_unstable_by_distance<P: Into<Point2>>(&mut self, target: P)[src]

Sorts slice by distance to target.

This sort is unstable (i.e., may reorder equal elements), in-place (i.e., does not allocate), and O(n * log(n)) worst-case.

Implementations on Foreign Types

impl<T: Distance + Copy> DistanceSlice<T> for [T][src]

fn sort_by_distance<P: Into<Point2>>(&mut self, target: P)[src]

fn sort_unstable_by_distance<P: Into<Point2>>(&mut self, target: P)[src]

Implementors