[][src]Struct coord_2d::Coord

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

General purpose coordinate

Fields

x: i32y: i32

Methods

impl Coord[src]

pub const fn new(x: i32, y: i32) -> Self[src]

pub fn from_size(size: Size) -> Result<Self, DimensionTooLargeForCoord>[src]

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

pub fn normalize(self, size: Size) -> Self[src]

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

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

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

pub fn with_axis<F: FnMut(i32) -> i32>(self, axis: Axis, f: F) -> Self[src]

pub fn set(self, axis: Axis, value: i32) -> Self[src]

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

pub fn new_axis(this_axis: i32, other_axis: i32, axis: Axis) -> Self[src]

pub fn get_static<A: StaticAxis>(self) -> i32[src]

pub fn get_static_mut<A: StaticAxis>(&mut self) -> &mut i32[src]

pub fn with_static_axis<A: StaticAxis, F: FnMut(i32) -> i32>(self, f: F) -> Self[src]

pub fn set_static<A: StaticAxis>(self, value: i32) -> Self[src]

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

pub fn new_static_axis<A: StaticAxis>(this_axis: i32, other_axis: i32) -> Self[src]

pub fn checked_add(self, rhs: Self) -> Option<Self>[src]

pub fn checked_sub(self, rhs: Self) -> Option<Self>[src]

pub fn checked_mul(self, rhs: i32) -> Option<Self>[src]

pub fn checked_div(self, rhs: i32) -> Option<Self>[src]

pub fn magnitude2(self) -> u32[src]

pub fn distance2(self, other: Self) -> u32[src]

pub fn manhattan_magnitude(self) -> u32[src]

pub fn manhattan_distance(self, other: Self) -> u32[src]

Trait Implementations

impl PartialOrd<Coord> for Coord[src]

impl Copy for Coord[src]

impl PartialEq<Coord> for Coord[src]

impl Default for Coord[src]

impl From<(i32, i32)> for Coord[src]

impl From<[i32; 2]> for Coord[src]

impl Clone for Coord[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for Coord[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Eq for Coord[src]

impl Debug for Coord[src]

impl Hash for Coord[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Add<Coord> for Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Coord> for &'a Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Coord> for Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a, 'b> Add<&'a Coord> for &'b Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl Add<Size> for Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Size> for &'a Coord[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Size> for Coord[src]

type Output = Coord

The resulting type after applying the + operator.

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

type Output = Coord

The resulting type after applying the + operator.

impl Add<Coord> for Size[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<Coord> for &'a Size[src]

type Output = Coord

The resulting type after applying the + operator.

impl<'a> Add<&'a Coord> for Size[src]

type Output = Coord

The resulting type after applying the + operator.

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

type Output = Coord

The resulting type after applying the + operator.

impl Sub<Coord> for Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Coord> for &'a Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Coord> for Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a, 'b> Sub<&'a Coord> for &'b Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl Sub<Size> for Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Size> for &'a Coord[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Size> for Coord[src]

type Output = Coord

The resulting type after applying the - operator.

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

type Output = Coord

The resulting type after applying the - operator.

impl Sub<Coord> for Size[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<Coord> for &'a Size[src]

type Output = Coord

The resulting type after applying the - operator.

impl<'a> Sub<&'a Coord> for Size[src]

type Output = Coord

The resulting type after applying the - operator.

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

type Output = Coord

The resulting type after applying the - operator.

impl Mul<i32> for Coord[src]

type Output = Coord

The resulting type after applying the * operator.

impl<'a> Mul<i32> for &'a Coord[src]

type Output = Coord

The resulting type after applying the * operator.

impl Div<i32> for Coord[src]

type Output = Coord

The resulting type after applying the / operator.

impl<'a> Div<i32> for &'a Coord[src]

type Output = Coord

The resulting type after applying the / operator.

impl<T> AddAssign<T> for Coord where
    Coord: Add<T, Output = Coord>, 
[src]

impl<T> SubAssign<T> for Coord where
    Coord: Sub<T, Output = Coord>, 
[src]

impl<T> MulAssign<T> for Coord where
    Coord: Mul<T, Output = Coord>, 
[src]

impl<T> DivAssign<T> for Coord where
    Coord: Div<T, Output = Coord>, 
[src]

Auto Trait Implementations

impl Send for Coord

impl Sync for Coord

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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