[−]Struct prototty_unix::Coord
General purpose coordinate
Fields
x: i32
y: i32
Methods
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 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,
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,
A: StaticAxis,
pub fn get_static_mut<A>(&mut self) -> &mut i32 where
A: StaticAxis,
A: StaticAxis,
pub fn with_static_axis<A, F>(self, f: F) -> Coord where
A: StaticAxis,
F: FnMut(i32) -> i32,
A: StaticAxis,
F: FnMut(i32) -> i32,
pub fn set_static<A>(self, value: i32) -> Coord where
A: StaticAxis,
A: StaticAxis,
pub fn set_static_in_place<A>(&mut self, value: i32) where
A: StaticAxis,
A: StaticAxis,
pub fn new_static_axis<A>(this_axis: i32, other_axis: i32) -> Coord where
A: StaticAxis,
A: StaticAxis,
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 fn magnitude2(self) -> u32
pub fn distance2(self, other: Coord) -> u32
pub fn manhattan_magnitude(self) -> u32
pub fn manhattan_distance(self, other: Coord) -> u32
Trait Implementations
impl Ord for Coord
fn cmp(&self, other: &Coord) -> Ordering
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
)Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more
impl<'a, 'b> Sub<&'a Coord> for &'b Size
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, &'a Coord) -> <&'b Size as Sub<&'a Coord>>::Output
impl<'a> Sub<&'a Coord> for Size
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, &'a Coord) -> <Size as Sub<&'a Coord>>::Output
impl<'a> Sub<&'a Coord> for Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, &'a Coord) -> <Coord as Sub<&'a Coord>>::Output
impl Sub<Coord> for Size
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord) -> <Size as Sub<Coord>>::Output
impl Sub<Coord> for Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord) -> <Coord as Sub<Coord>>::Output
impl<'a> Sub<Coord> for &'a Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord) -> <&'a Coord as Sub<Coord>>::Output
impl<'a, 'b> Sub<&'a Coord> for &'b Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, &'a Coord) -> <&'b Coord as Sub<&'a Coord>>::Output
impl<'a> Sub<&'a Size> for Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> <Coord as Sub<&'a Size>>::Output
impl<'a> Sub<Size> for &'a Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> <&'a Coord as Sub<Size>>::Output
impl<'a, 'b> Sub<&'a Size> for &'b Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: &'a Size) -> <&'b Coord as Sub<&'a Size>>::Output
impl Sub<Size> for Coord
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, size: Size) -> <Coord as Sub<Size>>::Output
impl<'a> Sub<Coord> for &'a Size
type Output = Coord
The resulting type after applying the -
operator.
fn sub(self, Coord) -> <&'a Size as Sub<Coord>>::Output
impl Eq for Coord
impl Default for Coord
impl PartialEq<Coord> for Coord
impl Mul<i32> for Coord
type Output = Coord
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> <Coord as Mul<i32>>::Output
impl<'a> Mul<i32> for &'a Coord
type Output = Coord
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> <&'a Coord as Mul<i32>>::Output
impl<T> DivAssign<T> for Coord where
Coord: Div<T>,
<Coord as Div<T>>::Output == Coord,
Coord: Div<T>,
<Coord as Div<T>>::Output == Coord,
fn div_assign(&mut self, rhs: T)
impl<'a> Div<i32> for &'a Coord
type Output = Coord
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> <&'a Coord as Div<i32>>::Output
impl Div<i32> for Coord
type Output = Coord
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> <Coord as Div<i32>>::Output
impl<T> AddAssign<T> for Coord where
Coord: Add<T>,
<Coord as Add<T>>::Output == Coord,
Coord: Add<T>,
<Coord as Add<T>>::Output == Coord,
fn add_assign(&mut self, rhs: T)
impl<T> MulAssign<T> for Coord where
Coord: Mul<T>,
<Coord as Mul<T>>::Output == Coord,
Coord: Mul<T>,
<Coord as Mul<T>>::Output == Coord,
fn mul_assign(&mut self, rhs: T)
impl Hash for Coord
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> SubAssign<T> for Coord where
Coord: Sub<T>,
<Coord as Sub<T>>::Output == Coord,
Coord: Sub<T>,
<Coord as Sub<T>>::Output == Coord,
fn sub_assign(&mut self, rhs: T)
impl Add<Coord> for Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord) -> <Coord as Add<Coord>>::Output
impl<'a, 'b> Add<&'a Coord> for &'b Size
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, &'a Coord) -> <&'b Size as Add<&'a Coord>>::Output
impl<'a> Add<Size> for &'a Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> <&'a Coord as Add<Size>>::Output
impl<'a> Add<Coord> for &'a Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord) -> <&'a Coord as Add<Coord>>::Output
impl<'a, 'b> Add<&'a Coord> for &'b Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, &'a Coord) -> <&'b Coord as Add<&'a Coord>>::Output
impl<'a> Add<&'a Coord> for Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, &'a Coord) -> <Coord as Add<&'a Coord>>::Output
impl<'a> Add<&'a Size> for Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> <Coord as Add<&'a Size>>::Output
impl Add<Size> for Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: Size) -> <Coord as Add<Size>>::Output
impl Add<Coord> for Size
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord) -> <Size as Add<Coord>>::Output
impl<'a> Add<Coord> for &'a Size
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, Coord) -> <&'a Size as Add<Coord>>::Output
impl<'a, 'b> Add<&'a Size> for &'b Coord
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, size: &'a Size) -> <&'b Coord as Add<&'a Size>>::Output
impl<'a> Add<&'a Coord> for Size
type Output = Coord
The resulting type after applying the +
operator.
fn add(self, &'a Coord) -> <Size as Add<&'a Coord>>::Output
impl Clone for Coord
fn clone(&self) -> Coord
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl From<(i32, i32)> for Coord
impl From<[i32; 2]> for Coord
impl PartialOrd<Coord> for Coord
fn partial_cmp(&self, other: &Coord) -> Option<Ordering>
fn lt(&self, other: &Coord) -> bool
fn le(&self, other: &Coord) -> bool
fn gt(&self, other: &Coord) -> bool
fn ge(&self, other: &Coord) -> bool
impl Debug for Coord
impl Copy for Coord
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,