[][src]Trait bestagon::distance::Distance

pub trait Distance {
    fn dist(&self, other: &Self) -> u8;
}

Required methods

fn dist(&self, other: &Self) -> u8

Return the grid distance from self to other.

Loading content...

Implementors

impl Distance for Axial[src]

fn dist(&self, other: &Axial) -> u8[src]

use bestagon::{coords::Axial, distance::Distance};
assert_eq!(Axial(0, 4).dist(&Axial(1, 2)), 2);
assert_eq!(Axial(-3, 2).dist(&Axial(3, -1)), 6);

impl Distance for Cube[src]

fn dist(&self, other: &Cube) -> u8[src]

use bestagon::{coords::Cube, distance::Distance};
assert_eq!(Cube(0, 4, -4).dist(&Cube(1, 2, -3)), 2);
assert_eq!(Cube(-3, 2, 1).dist(&Cube(3, -1, -2)), 6);
assert_eq!(Cube(-4, 4, 0).dist(&Cube(4, -4, 0)), 8);
Loading content...