Trait rust_sc2::distance::DistanceIterator [−][src]
pub trait DistanceIterator: Iterator + Sized where
Self::Item: Distance + Copy, { fn closer<T: Into<Point2>>(self, distance: f32, target: T) -> Closer<Self>ⓘ { ... } fn further<T: Into<Point2>>(self, distance: f32, target: T) -> Further<Self>ⓘ { ... } fn closest<T: Into<Point2>>(self, target: T) -> Option<Self::Item> { ... } fn furthest<T: Into<Point2>>(self, target: T) -> Option<Self::Item> { ... } fn closest_distance<T: Into<Point2>>(self, target: T) -> Option<f32> { ... } fn furthest_distance<T: Into<Point2>>(self, target: T) -> Option<f32> { ... } fn closest_distance_squared<T: Into<Point2>>(self, target: T) -> Option<f32> { ... } fn furthest_distance_squared<T: Into<Point2>>(
self,
target: T
) -> Option<f32> { ... } fn sort_by_distance<T: Into<Point2>>(
self,
target: T
) -> IntoIter<Self::Item> { ... } fn sort_unstable_by_distance<T: Into<Point2>>(
self,
target: T
) -> IntoIter<Self::Item> { ... } }
Helper trait for iterators of items implementing Distance.
Provided methods
fn closer<T: Into<Point2>>(self, distance: f32, target: T) -> Closer<Self>ⓘ[src]
Filters all items closer than given distance to target.
fn further<T: Into<Point2>>(self, distance: f32, target: T) -> Further<Self>ⓘ[src]
Filters all items further than given distance to target.
fn closest<T: Into<Point2>>(self, target: T) -> Option<Self::Item>[src]
Returns closest to target item in iterator.
fn furthest<T: Into<Point2>>(self, target: T) -> Option<Self::Item>[src]
Returns furthest to target item in iterator.
fn closest_distance<T: Into<Point2>>(self, target: T) -> Option<f32>[src]
Returns distance to closest to target item in iterator.
fn furthest_distance<T: Into<Point2>>(self, target: T) -> Option<f32>[src]
Returns distance to furthest to target item in iterator.
fn closest_distance_squared<T: Into<Point2>>(self, target: T) -> Option<f32>[src]
Returns squared distance to closest to target item in iterator.
fn furthest_distance_squared<T: Into<Point2>>(self, target: T) -> Option<f32>[src]
Returns squared distance to furthest to target item in iterator.
fn sort_by_distance<T: Into<Point2>>(self, target: T) -> IntoIter<Self::Item>[src]
Returns iterator of items sorted 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<T: Into<Point2>>(
self,
target: T
) -> IntoIter<Self::Item>[src]
self,
target: T
) -> IntoIter<Self::Item>
Returns iterator of items sorted 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.