[−][src]Struct coord_2d::Coord
General purpose coordinate
Fields
x: i32
y: 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 Clone for Coord
[src]
fn clone(&self) -> 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 cmp(&self, other: &Coord) -> Ordering
[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
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Default for Coord
[src]
impl From<(i32, i32)> for Coord
[src]
impl From<[i32; 2]> for Coord
[src]
impl PartialOrd<Coord> for Coord
[src]
fn partial_cmp(&self, other: &Coord) -> Option<Ordering>
[src]
fn lt(&self, other: &Coord) -> bool
[src]
fn le(&self, other: &Coord) -> bool
[src]
fn gt(&self, other: &Coord) -> bool
[src]
fn ge(&self, other: &Coord) -> bool
[src]
impl PartialEq<Coord> for Coord
[src]
impl Copy for Coord
[src]
impl Eq for Coord
[src]
impl Debug for Coord
[src]
impl Add<Coord> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<Coord> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<&'a Coord> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Coord> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Add<Size> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<Size> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> Self::Output
[src]
impl<'a> Add<&'a Size> for Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Size> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> Self::Output
[src]
impl Add<Coord> for Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<Coord> for &'a Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Add<&'a Coord> for Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Add<&'a Coord> for &'b Size
[src]
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Sub<Coord> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<Coord> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<&'a Coord> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Coord> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Sub<Size> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<Size> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> Self::Output
[src]
impl<'a> Sub<&'a Size> for Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Size> for &'b Coord
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> Self::Output
[src]
impl Sub<Coord> for Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<Coord> for &'a Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: Coord) -> Self::Output
[src]
impl<'a> Sub<&'a Coord> for Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl<'a, 'b> Sub<&'a Coord> for &'b Size
[src]
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord { x: x, y: y }: &'a Coord) -> Self::Output
[src]
impl Mul<i32> for Coord
[src]
type Output = Coord
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Self::Output
[src]
impl<'a> Mul<i32> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Self::Output
[src]
impl Div<i32> for Coord
[src]
type Output = Coord
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Self::Output
[src]
impl<'a> Div<i32> for &'a Coord
[src]
type Output = Coord
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Self::Output
[src]
impl<T> AddAssign<T> for Coord where
Coord: Add<T, Output = Coord>,
[src]
Coord: Add<T, Output = Coord>,
fn add_assign(&mut self, rhs: T)
[src]
impl<T> SubAssign<T> for Coord where
Coord: Sub<T, Output = Coord>,
[src]
Coord: Sub<T, Output = Coord>,
fn sub_assign(&mut self, rhs: T)
[src]
impl<T> MulAssign<T> for Coord where
Coord: Mul<T, Output = Coord>,
[src]
Coord: Mul<T, Output = Coord>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T> DivAssign<T> for Coord where
Coord: Div<T, Output = Coord>,
[src]
Coord: Div<T, Output = Coord>,
fn div_assign(&mut self, rhs: T)
[src]
impl Hash for Coord
[src]
Auto Trait Implementations
impl Unpin for Coord
impl Sync for Coord
impl Send for Coord
impl UnwindSafe for Coord
impl RefUnwindSafe for Coord
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,