Struct grid_search_cardinal::Coord[]

pub struct Coord {
    pub x: i32,
    pub y: i32,
}

General purpose coordinate

Fields

x: i32y: i32

Implementations

impl Coord

pub const fn new(x: i32, y: i32) -> Coord

pub fn from_size(size: Size) -> Result<Coord, DimensionTooLargeForCoord>

pub fn to_size(self) -> Result<Size, NegativeDimension>

pub fn normalize(self, size: Size) -> Coord

pub fn is_valid(self, size: Size) -> bool

pub fn constrain(self, size: Size) -> Option<Coord>

pub fn get(self, axis: Axis) -> i32

pub fn get_mut(&mut self, axis: Axis) -> &mut i32

pub fn with_axis<F>(self, axis: Axis, f: F) -> Coord where
    F: FnMut(i32) -> i32

pub fn set(self, axis: Axis, value: i32) -> Coord

pub fn set_in_place(&mut self, axis: Axis, value: i32)

pub fn new_axis(this_axis: i32, other_axis: i32, axis: Axis) -> Coord

pub fn get_static<A>(self) -> i32 where
    A: StaticAxis, 

pub fn get_static_mut<A>(&mut self) -> &mut i32 where
    A: StaticAxis, 

pub fn with_static_axis<A, F>(self, f: F) -> Coord where
    F: FnMut(i32) -> i32,
    A: StaticAxis, 

pub fn set_static<A>(self, value: i32) -> Coord where
    A: StaticAxis, 

pub fn set_static_in_place<A>(&mut self, value: i32) where
    A: StaticAxis, 

pub fn new_static_axis<A>(this_axis: i32, other_axis: i32) -> Coord where
    A: StaticAxis, 

pub fn set_x(self, x: i32) -> Coord

pub fn set_y(self, y: i32) -> Coord

pub fn set_x_in_place(&mut self, x: i32)

pub fn set_y_in_place(&mut self, y: i32)

pub fn checked_add(self, rhs: Coord) -> Option<Coord>

pub fn checked_sub(self, rhs: Coord) -> Option<Coord>

pub fn checked_mul(self, rhs: i32) -> Option<Coord>

pub fn checked_div(self, rhs: i32) -> Option<Coord>

pub const fn magnitude2(self) -> u32

pub const fn distance2(self, other: Coord) -> u32

pub const fn manhattan_magnitude(self) -> u32

pub const fn manhattan_distance(self, other: Coord) -> u32

pub const fn opposite(self) -> Coord

pub const fn left90(self) -> Coord

pub const fn right90(self) -> Coord

pub const fn cardinal_left45(self) -> Coord

pub const fn cardinal_right45(self) -> Coord

pub const fn cardinal_left135(self) -> Coord

pub const fn cardinal_right135(self) -> Coord

pub fn is_zero(self) -> bool

pub fn pairwise_max(self, other: Coord) -> Coord

pub fn pairwise_min(self, other: Coord) -> Coord

Trait Implementations

impl<'a, 'b> Add<&'a Coord> for &'b Coord

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Coord> for Coord

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Coord> for Size

type Output = Coord

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'a Coord> for &'b Size

type Output = Coord

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'a Size> for &'b Coord

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Size> for Coord

type Output = Coord

The resulting type after applying the + operator.

impl Add<Coord> for Coord

type Output = Coord

The resulting type after applying the + operator.

impl Add<Coord> for Size

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Coord> for &'a Size

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Coord> for &'a Coord

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Size> for &'a Coord

type Output = Coord

The resulting type after applying the + operator.

impl Add<Size> for Coord

type Output = Coord

The resulting type after applying the + operator.

impl<T> AddAssign<T> for Coord where
    Coord: Add<T>,
    <Coord as Add<T>>::Output == Coord

impl Clone for Coord

impl Copy for Coord

impl Debug for Coord

impl Default for Coord

impl<'a> Div<i32> for &'a Coord

type Output = Coord

The resulting type after applying the / operator.

impl Div<i32> for Coord

type Output = Coord

The resulting type after applying the / operator.

impl<T> DivAssign<T> for Coord where
    Coord: Div<T>,
    <Coord as Div<T>>::Output == Coord

impl Eq for Coord

impl From<[i32; 2]> for Coord

impl From<(i32, i32)> for Coord

impl Hash for Coord

impl<'a> Mul<i32> for &'a Coord

type Output = Coord

The resulting type after applying the * operator.

impl Mul<i32> for Coord

type Output = Coord

The resulting type after applying the * operator.

impl<T> MulAssign<T> for Coord where
    Coord: Mul<T>,
    <Coord as Mul<T>>::Output == Coord

impl Neg for Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Neg for &'a Coord

type Output = Coord

The resulting type after applying the - operator.

impl Ord for Coord

impl PartialEq<Coord> for Coord

impl PartialOrd<Coord> for Coord

impl StructuralEq for Coord

impl StructuralPartialEq for Coord

impl<'a, 'b> Sub<&'a Coord> for &'b Size

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Coord> for Size

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Coord> for Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'a Coord> for &'b Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'a Size> for &'b Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Size> for Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Coord> for &'a Size

type Output = Coord

The resulting type after applying the - operator.

impl Sub<Coord> for Coord

type Output = Coord

The resulting type after applying the - operator.

impl Sub<Coord> for Size

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Coord> for &'a Coord

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Size> for &'a Coord

type Output = Coord

The resulting type after applying the - operator.

impl Sub<Size> for Coord

type Output = Coord

The resulting type after applying the - operator.

impl<T> SubAssign<T> for Coord where
    Coord: Sub<T>,
    <Coord as Sub<T>>::Output == Coord

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.