ICoord

Struct ICoord 

Source
pub struct ICoord {
    pub x: i32,
    pub y: i32,
}
Expand description

General purpose icoordinate

Fields§

§x: i32§y: i32

Implementations§

Source§

impl ICoord

Source

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

Source

pub const fn from_ucoord(ucoord: UCoord) -> ICoord

Source

pub fn to_ucoord(self) -> UCoord

Source

pub const fn normalize(self, ucoord: UCoord) -> ICoord

Source

pub const fn is_valid(self, ucoord: UCoord) -> bool

Source

pub const fn constrain(self, ucoord: UCoord) -> Option<ICoord>

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub const fn magnitude2(self) -> u32

Source

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

Source

pub const fn manhattan_magnitude(self) -> u32

Source

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

Source

pub const fn opposite(self) -> ICoord

Source

pub const fn left90(self) -> ICoord

Source

pub const fn right90(self) -> ICoord

Source

pub const fn cardinal_left45(self) -> ICoord

Source

pub const fn cardinal_right45(self) -> ICoord

Source

pub const fn cardinal_left135(self) -> ICoord

Source

pub const fn cardinal_right135(self) -> ICoord

Source

pub const fn is_zero(self) -> bool

Source

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

Source

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

Source

pub const fn transpose(self) -> ICoord

Trait Implementations§

Source§

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

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <&'b ICoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a, 'b> Add<&'a ICoord> for &'b UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <&'b UCoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <ICoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: &'a ICoord) -> <UCoord as Add<&'a ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a, 'b> Add<&'a UCoord> for &'b ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <&'b ICoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<&'a UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: &'a UCoord) -> <ICoord as Add<&'a UCoord>>::Output

Performs the + operation. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <&'a ICoord as Add<ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<ICoord> for &'a UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <&'a UCoord as Add<ICoord>>::Output

Performs the + operation. Read more
Source§

impl Add<ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <UCoord as Add<ICoord>>::Output

Performs the + operation. Read more
Source§

impl<'a> Add<UCoord> for &'a ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <&'a ICoord as Add<UCoord>>::Output

Performs the + operation. Read more
Source§

impl Add<UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, ucoord: UCoord) -> <ICoord as Add<UCoord>>::Output

Performs the + operation. Read more
Source§

impl Add for ICoord

Source§

type Output = ICoord

The resulting type after applying the + operator.
Source§

fn add(self, _: ICoord) -> <ICoord as Add>::Output

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl Clone for ICoord

Source§

fn clone(&self) -> ICoord

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ICoord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ICoord

Source§

fn default() -> ICoord

Returns the “default value” for a type. Read more
Source§

impl Display for ICoord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> <&'a ICoord as Div<i32>>::Output

Performs the / operation. Read more
Source§

impl Div<i32> for ICoord

Source§

type Output = ICoord

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> <ICoord as Div<i32>>::Output

Performs the / operation. Read more
Source§

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

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl From<[i32; 2]> for ICoord

Source§

fn from(array: [i32; 2]) -> ICoord

Converts to this type from the input type.
Source§

impl From<(i32, i32)> for ICoord

Source§

fn from(_: (i32, i32)) -> ICoord

Converts to this type from the input type.
Source§

impl Hash for ICoord

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

Feeds a slice of this type into the given Hasher. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> <&'a ICoord as Mul<i32>>::Output

Performs the * operation. Read more
Source§

impl Mul<i32> for ICoord

Source§

type Output = ICoord

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> <ICoord as Mul<i32>>::Output

Performs the * operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<'a> Neg for &'a ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&'a ICoord as Neg>::Output

Performs the unary - operation. Read more
Source§

impl Neg for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn neg(self) -> <ICoord as Neg>::Output

Performs the unary - operation. Read more
Source§

impl Ord for ICoord

Source§

fn cmp(&self, other: &ICoord) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ICoord

Source§

fn eq(&self, other: &ICoord) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ICoord

Source§

fn partial_cmp(&self, other: &ICoord) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <&'b ICoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a, 'b> Sub<&'a ICoord> for &'b UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <&'b UCoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <ICoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: &'a ICoord) -> <UCoord as Sub<&'a ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a, 'b> Sub<&'a UCoord> for &'b ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <&'b ICoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<&'a UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: &'a UCoord) -> <ICoord as Sub<&'a UCoord>>::Output

Performs the - operation. Read more
Source§

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

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <&'a ICoord as Sub<ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<ICoord> for &'a UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <&'a UCoord as Sub<ICoord>>::Output

Performs the - operation. Read more
Source§

impl Sub<ICoord> for UCoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <UCoord as Sub<ICoord>>::Output

Performs the - operation. Read more
Source§

impl<'a> Sub<UCoord> for &'a ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <&'a ICoord as Sub<UCoord>>::Output

Performs the - operation. Read more
Source§

impl Sub<UCoord> for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, ucoord: UCoord) -> <ICoord as Sub<UCoord>>::Output

Performs the - operation. Read more
Source§

impl Sub for ICoord

Source§

type Output = ICoord

The resulting type after applying the - operator.
Source§

fn sub(self, _: ICoord) -> <ICoord as Sub>::Output

Performs the - operation. Read more
Source§

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

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl Copy for ICoord

Source§

impl Eq for ICoord

Source§

impl StructuralPartialEq for ICoord

Auto Trait Implementations§

§

impl Freeze for ICoord

§

impl RefUnwindSafe for ICoord

§

impl Send for ICoord

§

impl Sync for ICoord

§

impl Unpin for ICoord

§

impl UnwindSafe for ICoord

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.