[][src]Struct rltk::Point

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

Helper struct defining a 2D point in space.

Fields

x: i32y: i32

Methods

impl Point[src]

pub fn new<T>(x: T, y: T) -> Point where
    T: TryInto<i32>, 
[src]

Create a new point from an x/y coordinate.

pub fn zero() -> Self[src]

pub fn from_tuple<T>(t: (T, T)) -> Self where
    T: TryInto<i32>, 
[src]

pub fn to_index<T>(&self, width: T) -> usize where
    T: TryInto<usize>, 
[src]

pub fn to_tuple(&self) -> (i32, i32)[src]

pub fn to_unsigned_tuple(&self) -> (usize, usize)[src]

Trait Implementations

impl Add<Point> for Point[src]

Overloads: We support basic point math Support adding a point to a point

type Output = Point

The resulting type after applying the + operator.

impl Add<i32> for Point[src]

Support adding an int to a point

type Output = Point

The resulting type after applying the + operator.

impl Clone for Point[src]

impl Copy for Point[src]

impl Debug for Point[src]

impl Div<Point> for Point[src]

Support dividing a point by a point

type Output = Point

The resulting type after applying the / operator.

impl Div<f32> for Point[src]

Support dividing a point by an f32

type Output = Point

The resulting type after applying the / operator.

impl Div<i32> for Point[src]

Support dividing a point by an int

type Output = Point

The resulting type after applying the / operator.

impl Eq for Point[src]

impl Hash for Point[src]

impl Mul<Point> for Point[src]

Support multiplying a point by a point

type Output = Point

The resulting type after applying the * operator.

impl Mul<f32> for Point[src]

Support multiplying a point by an f32

type Output = Point

The resulting type after applying the * operator.

impl Mul<i32> for Point[src]

Support multiplying a point by an int

type Output = Point

The resulting type after applying the * operator.

impl PartialEq<Point> for Point[src]

impl StructuralEq for Point[src]

impl StructuralPartialEq for Point[src]

impl Sub<Point> for Point[src]

Support subtracting a point from a point

type Output = Point

The resulting type after applying the - operator.

impl Sub<i32> for Point[src]

Support subtracting an int from a point

type Output = Point

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Point

impl Send for Point

impl Sync for Point

impl Unpin for Point

impl UnwindSafe for Point

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,