pub trait PointTrait: Copy + Eq {
    type N;

    // Required methods
    fn manhattan(self) -> Self::N;
    fn decr(self) -> Self;
    fn incr(self) -> Self;
    fn inclusive_range(min: Self, max: Self) -> Box<dyn Iterator<Item = Self>>;
    fn boundary_min(self, other: Self) -> Self;
    fn boundary_max(self, other: Self) -> Self;
    fn volume<T>(self) -> T
       where T: From<Self::N> + Mul<Output = T>;

    // Provided method
    fn adjacent(self) -> Box<dyn Iterator<Item = Self>>
       where Self: 'static { ... }
}

Required Associated Types§

source

type N

Numeric type backing this point

Required Methods§

source

fn manhattan(self) -> Self::N

Return the manhattan distance of this point from the origin.

source

fn decr(self) -> Self

Reduce all components of this point by 1.

source

fn incr(self) -> Self

Increase all components of this point by 1.

source

fn inclusive_range(min: Self, max: Self) -> Box<dyn Iterator<Item = Self>>

Generate all points inclusively bounded by min and max.

source

fn boundary_min(self, other: Self) -> Self

Return the boundary minimum between self and other.

This is defined as a new point with each component defined by self.component.min(other.component).

source

fn boundary_max(self, other: Self) -> Self

Return the boundary maximum between self and other.

This is defined as a new point with each component defined by self.component.max(other.component).

source

fn volume<T>(self) -> Twhere T: From<Self::N> + Mul<Output = T>,

Return the volume of the space defined between this point and the origin.

Provided Methods§

source

fn adjacent(self) -> Box<dyn Iterator<Item = Self>>where Self: 'static,

Iterate over points adjacent to this point.

This includes diagonals, and excludes the center.

The implementation should always return a constant number of items, even if for simplicity it does not implement ExactSizeIterator.

Implementors§